|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Please help. I am at my wits end.
I have SQL Server 2000 on a Windows 2003 server. I have my database on a Nmade Instance . Named Pipes is disabled and only TCP/IP is enabled. Authentication is set to Windows only. The server is in Active Directory. My web site is on a Windows 2000 server with IIS 5. I have installed the Client Network Utilities and set the alias to TCP/IP also. I can connect to the SQL server using the Query Analyzer. I have downloaded and installed ActiveState's ActivePerl 5.6.1.638-MSWin32-x86.msi on both machines. I have also installed DBI and DBD::ODBC on both machine. Both machine have MDAC 2.8 installed. The code I am using to connect is as follows: my $user = 'user'; my $pass = 'password'; my $db = "database"; my $server = "servername\\instancename"; my $ipadd = "xxx.xx.xx.xxx,xxxx"; my $driver = '{SQL Server}'; Option #1 $DSN = 'driver=$driver;Server=$server;uid=$user;pwd=$pass;database=$db;network=DBMSSOCN;address=$ipadd;'; $dbh = DBI->connect("dbi:ODBC:$DSN") or die 'Cannot Open SQL Server Database $DBI::errstr\n'; Option #2 $DSN = 'driver=$driver;Server=$server;uid=$user;pwd=$pass;database=$db'; $dbh = DBI->connect("dbi:ODBC:$DSN") or die 'Cannot Open SQL Server Database $DBI::errstr\n'; Option #3 $dbh = DBI->connect('dbi:ODBC:driver=$driver:dsn',$user,$pass) or die 'Cannot Open SQL Server Database $DBI::errstr\n'; Option #4 $dbh = DBI->connect("dbi:ODBC:database=$db;server=$server",$user,$pass) or die '$DBI::errstr\n'; From all that I have read and from previous scripts I have written, any of these should work, but I am getting the following error. DBI connect('driver=$driver:dsn','user',...) failed: at C:\cgi-bin\CGI.pl line xxx Cannot Open SQL Server Database $DBI::errstr\n at C:\cgi-bin\CGI.pl line xxx. Where xxx = the line number of the connection call. All of my previous scripts have been written for forms where the web server(Apache), database(MySQL), and script(Perl CGI) are all on the same machine. I am not at all familiar with SQL Server, and am struggling to learn quickly. PLease any ideas would be greatly appreciated. Thank you LANAC |
|
#2
|
||||
|
||||
|
The thing that I noticed in your post was "Authentication is set to Windows only." When integrated security is used, you don't enter a UserId/Password combination in the connect statement since the authentication is coming from Active Directory.
If possible you might want to set your database to mixed security and try connecting using a UserId/Password. If you can get that to work, then set it back to "Windows Only" and see if you can get Integrated Security to work. This might help you isolate whether the problem was the syntax of your connect statement or your connectivity to Active Directory authentication that is causing a problem. Since the error message doesn't return a message from SQL Server, it looks like you currently have a syntax error of some kind. But I'm not much of a Perl guru so I can't tell. Read the following link and see if it has anything useful in it. You'll notice they explicitly mention Integrated Security and leave off the UserId/Passwords in their connects: http://www.experts-exchange.com/Dat...Q_20889697.html I wish I could be more helpful, but like you, I've never used Perl to connect to SQL Server. ![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Problems connecting to SQL Server DB using Perl CGI |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|