Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

SQL2000
Hi all,

Not sure if this is the right list to ask this question but this is the best
 list to get answares so I am going to give it a shot. I am trying to connec
t to SQL2000 server from a winXP box. I keep on failing with same error, any
 help would be apreciated


#!PERl
use warnings;
use strict;
use Net::MySQL;
use DBI;
$|=1;


my $user='xxx';
my $password = '....';
my $database = "nnsdata_ptest";
my $hostname='somehost.com;
my $port = '1444';


my $dsn = "host=$hostname;port=$port";
my $dbh = DBI->connect("DBI:mysql:$dsn", $user, $password);

error:
main::count() called too early to check prototype at C:\temp\perl\te.pl line
 71.
DBI connect('host=somehost.com;port=1444','username',...) failed: Lost conne
ction to MySQL server during query at C:\temp\perl\te.pl line 21



Report this thread to moderator Post Follow-up to this message
Old Post
mgoland@optonline.net
10-19-04 01:55 AM


Re: SQL2000
Subject: SQL2000
> Hi all,
>
>  Not sure if this is the right list to ask this question but this is
>  the best list to get answares so I am going to give it a shot. I am
>  trying to connect to SQL2000 server from a winXP box. I keep on
>  failing with same error, any help would be apreciate
> d
>
> #!PERl
> use warnings;
> use strict;
> use Net::MySQL;

I thought you said SQL2000 and meant Microsoft SQL Server 2000!

> use DBI;
> $|=1;
>
>
> my $user='xxx';
> my $password = '....';
> my $database = "nnsdata_ptest";
> my $hostname='somehost.com;
> my $port = '1444';
>
>
> my $dsn = "host=$hostname;port=$port";
> my $dbh = DBI->connect("DBI:mysql:$dsn", $user, $password);

Again I thought you meant MS SQL Server 2000, not mysql.
That's a completely different and totally incompatible database!

You want to use DBD::ODBC, not DBD::mysql

Try:

my $DSN = "driver=SQL  Server;Server=$hostname;Database=$databa
se';
my $dbh = DBI->connect("DBI:ODBC:$dsn", $user, $password);

HTH, Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


Report this thread to moderator Post Follow-up to this message
Old Post
Jenda Krynicky
10-19-04 01:55 AM


Re: SQL2000
Jenda,
Thanks you are correct as usual. I do need to connect to MS SQL Server.
DB Stuff is a new task for me. Are there ODBC Drivers for Unix servers ?? Or
Alternative ways of accessing MS SQL from Unix servers ??
----- Original Message -----
From: "Jenda Krynicky" <Jenda@Krynicky.cz>
To: <beginners@perl.org>
Sent: Monday, October 18, 2004 6:24 PM
Subject: Re: SQL2000


> Subject: SQL2000 
>
> I thought you said SQL2000 and meant Microsoft SQL Server 2000!
> 
>
> Again I thought you meant MS SQL Server 2000, not mysql.
> That's a completely different and totally incompatible database!
>
> You want to use DBD::ODBC, not DBD::mysql
>
> Try:
>
> my $DSN = "driver=SQL  Server;Server=$hostname;Database=$databa
se';
> my $dbh = DBI->connect("DBI:ODBC:$dsn", $user, $password);
>
> HTH, Jenda
> ===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
> When it comes to wine, women and song, wizards are allowed
> to get drunk and croon as much as they like.
> -- Terry Pratchett in Sourcery
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Mark Goland
10-19-04 01:55 AM


Re: SQL2000
----- Original Message -----
From: "Mark Goland" <mgoland@optonline.net>
To: "Jenda Krynicky" <Jenda@Krynicky.cz>; <beginners@perl.org>
Sent: Monday, October 18, 2004 6:33 PM
Subject: Re: SQL2000


> Jenda,
>     Thanks you are correct as usual. I do need to connect to MS SQL
Server.
> DB Stuff is a new task for me. Are there ODBC Drivers for Unix servers ??
Or
> Alternative ways of accessing MS SQL from Unix servers ??
> ----- Original Message -----
> From: "Jenda Krynicky" <Jenda@Krynicky.cz>
> To: <beginners@perl.org>
> Sent: Monday, October 18, 2004 6:24 PM
> Subject: Re: SQL2000
>
> 
Hmm Still fails, now I get :
main::count() called too early to check prototype at C:\temp\perl\te.pl line
64.
DBI connect('driver=SQL
Server;Server=mysite.com;Database=nnsdata_ptest','username',...) failed:  at
C:\t
emp\perl\te.pl line 24

 
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Mark Goland
10-19-04 01:55 AM


Re: SQL2000
From:           	Mark Goland <mgoland@optonline.net> 
> Hmm Still fails, now I get :
> main::count() called too early to check prototype at
> C:\temp\perl\te.pl line 64. DBI connect('driver=SQL
> Server;Server=mysite.com;Database=nnsdata_ptest','username',...)
> failed:  at C:\t emp\perl\te.pl line 24

Strange. Could you resend the whole test script?

Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


Report this thread to moderator Post Follow-up to this message
Old Post
Jenda Krynicky
10-19-04 01:55 AM


Re: SQL2000
$dsn="DBI:whateverurusing:DatabaseName"

connecting is done this way ...

$dbh=DBI->connect($dsn,$user,$password);
Atleast thats the way it works ;) ...
Give it a try


Report this thread to moderator Post Follow-up to this message
Old Post
ragner4u@gmail.com
10-19-04 08:57 AM


RE: SQL2000
Mark Goland wrote:
...
> Are there ODBC Drivers for Unix servers ??

Yes. I've not used any personally.

> Or Alternative ways of accessing MS SQL from Unix
> servers ??

I use DBD::Proxy and DBI::ProxyServer for this. Works great.

Report this thread to moderator Post Follow-up to this message
Old Post
Bob Showalter
10-19-04 01:58 PM


Re: SQL2000

----- Original Message -----
From: Jenda Krynicky <Jenda@Krynicky.cz>
Date: Monday, October 18, 2004 6:52 pm
Subject: Re: SQL2000

> From:           	Mark Goland <mgoland@optonline.net> 
> give it 
>  Server;Server=$hostname;Database=$databa
se';> > > my $dbh = DBI- 
>
> Strange. Could you resend the whole test script?
Sure,
While looking at my code, looks like its trying to connect to default port. 
I am unable to get it to connect to my port [ 1444 ], here is the code

#!PERl
use warnings;
use strict;
$|=1;
use DBI;



my $user='username';
my $password = ''pwd';
my $database = "nnsdata_ptest";
my $hostname='myhost.com';
my $port = '1444';

my $dsn = "driver=SQL  Server;Server=$hostname;Database=$databa
se;Port=$port"
;
my $dbh = DBI->connect("DBI:ODBC:$dsn", $user, $password);




>
> Jenda
> ===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
> When it comes to wine, women and song, wizards are allowed
> to get drunk and croon as much as they like.
> 	-- Terry Pratchett in Sourcery
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>


Report this thread to moderator Post Follow-up to this message
Old Post
mgoland@optonline.net
10-19-04 08:55 PM


Re: SQL2000
From: mgoland@optonline.net
> Sure,
>    While looking at my code, looks like its trying to connect to
>    default port. I am unable to get it to connect to my port [ 1444 ],
>    here is the code
>
> #!PERl
> use warnings;
> use strict;
> $|=1;
> use DBI;
>
> my $user='username';
> my $password = ''pwd';
> my $database = "nnsdata_ptest";
> my $hostname='myhost.com';
> my $port = '1444';
>
> my $dsn = "driver=SQL
>  Server;Server=$hostname;Database=$databa
se;Port=$port"; my $dbh =
> DBI->connect("DBI:ODBC:$dsn", $user, $password);

I think you are right. It seems to be ignoring the Port since if I
change the $hostname, $database, $user and $password I can connect to
my MS SQL even though it's on the default prompt.

Seems you will have to create a server alias via
Start\Programs\Microsoft SQL Server\Client Network Utility

There you can specify the port.

You would then use the alias you create instead of the myhost.com in
$hostname.

Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


Report this thread to moderator Post Follow-up to this message
Old Post
Jenda Krynicky
10-19-04 08:55 PM


Re: SQL2000
Mark

To answer your questions, there are ODBC drivers available from
www.openlinksw.com that pretty much satisfy your requirements to a T.
Secondly, a good resource for understanding how to get your connection
going with Perl and ODBC to MySQL, or any other database, can be found
at www.iodbc.org.

Regards
Emmon Simbo

Jenda@Krynicky.cz (Jenda Krynicky) wrote in message news:<417567F9.21605.19EBEC82@localhost
>...
> From: mgoland@optonline.net 
>
> I think you are right. It seems to be ignoring the Port since if I
> change the $hostname, $database, $user and $password I can connect to
> my MS SQL even though it's on the default prompt.
>
> Seems you will have to create a server alias via
> Start\Programs\Microsoft SQL Server\Client Network Utility
>
> There you can specify the port.
>
> You would then use the alias you create instead of the myhost.com in
> $hostname.
>
> Jenda
> ===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
> When it comes to wine, women and song, wizards are allowed
> to get drunk and croon as much as they like.
> 	-- Terry Pratchett in Sourcery

Report this thread to moderator Post Follow-up to this message
Old Post
Emmon Simbo
10-25-04 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:59 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.