RE: Trouble connecting to ms sql with ODBC on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



you should already have that file if you have installed MS SQL server (Client Tools) on your pc.  If not, I can probably send you the file.  Nothing to do with PHP, so don't recompile.


--
Gerardo S. Rojas
mailto: grojas@strategicinc.com


-----Original Message-----
From: Stoner, David M. [mailto:dmstoner@utmb.edu]
Sent: Thursday, October 30, 2003 3:01 PM
To: Gerardo Rojas
Subject: RE:  Trouble connecting to ms sql with ODBC on Windows


OK, I'll do that.  I was just looking, and it says I need ntwdblib.dll.
Maybe I already have that.  I don't know if I need to recompile PHP
--with-mssql etc.

-----Original Message-----
From: Gerardo Rojas [mailto:grojas@strategicinc.com] 
Sent: Thursday, October 30, 2003 2:58 PM
To: Stoner, David M.
Subject: RE:  Trouble connecting to ms sql with ODBC on Windows


you will need to uncomment the extension for MS SQL Server in your PHP.ini

extension=php_mssql.dll



--
Gerardo S. Rojas
mailto: grojas@strategicinc.com


-----Original Message-----
From: Stoner, David M. [mailto:dmstoner@utmb.edu]
Sent: Thursday, October 30, 2003 2:55 PM
To: Gerardo Rojas
Subject: RE:  Trouble connecting to ms sql with ODBC on Windows


OK, thanks, I'll try mssql functions next.  But ODBC works too, some of the
time!

-----Original Message-----
From: Gerardo Rojas [mailto:grojas@strategicinc.com] 
Sent: Thursday, October 30, 2003 2:54 PM
To: Stoner, David M.; php-windows@lists.php.net
Subject: RE:  Trouble connecting to ms sql with ODBC on Windows


You don't have to use ODBC to connect.  PHP supports connectivity to MS SQL
Server!


--
Gerardo S. Rojas
mailto: grojas@strategicinc.com


-----Original Message-----
From: Stoner, David M. [mailto:dmstoner@utmb.edu]
Sent: Thursday, October 30, 2003 1:53 PM
To: 'php-windows@lists.php.net'
Subject:  Trouble connecting to ms sql with ODBC on Windows




I'm new to this mailing list.

I'm using ODBC to connect to a database on a remote SQL Server from Windows
2000. I'm running PHP 4.3.3. with Apache 2, but I've also tried this with
Apache 1.3.


Here's the entire script (with dummy name, id and password):

<?php
if(function_exists("odbc_pconnect"))
	{
	$id =
odbc_pconnect("DataSourceName","MyId","MyPassword",SQL_CUR_USE_ODBC);
	if($id)
		{
		echo "connected\n";
		$resid = odbc_prepare($id,"select
strLastname,strFirstname,strUsername \nfrom dbo.tblPersons where
strPersonType = 'S' and strSchoolCode = 'MED' Order by
strLastname,strFirstname");
		$succ = odbc_execute($resid);
		if($succ)
			{
			odbc_result_all($resid);
			odbc_close($id);
			}
		}
	else
		echo "failed to connect\n";
	}
else
	{
	print "no such function\n";
	}
?>

This works just fine when I call it from the command line.   It connects and
retrieves just the data I expect.

But when I embed exactly the same script in a web page I get this:

Warning: odbc_connect(): SQL error: [Microsoft][ODBC SQL Server
Driver][Named Pipes]Specified SQL server not found., SQL state 08001 in
SQLConnect in c:\apachegroup\apache13\apache\users\dmstoner\odbctest.php on
line 13 failed to connect 

What am I doing wrong???

Any help much appreciated.

-David

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux