Jump to content

Problem connecting to sql server from php


BlackLava

Recommended Posts

Hi

 

I got a problem connecting to ms sql server 2000 from php using odbc.

My server tech installed for me freetds...

 

Here is what I have :

 

Error message :

Warning: odbc_connect() [function.odbc-connect]: SQL error: [FreeTDS]

Read from SQL server failed., SQL state 08S01 in SQLConnect in...

 

DSN in odbc.conf :

[MSSQL]

Driver = /usr/local/freetds/lib/libtdsodbc.so

Description = MSSQL

Trace = No

Server = 208.99.194.130

Database = ProWagSys

Port = 1433

 

Php code :

putenv('ODBCINI=/....Path..../odbc.conf');

$username="xxxx";

$password="xxxxxxxxxxxx";

$sqlconnect=odbc_connect("MSSQL",$username,$passwo rd);

 

 

The path to odbc.conf is right, username & password too, no problem there.

 

Please help me, starting to make me crazy

 

Guy

Link to comment
Share on other sites

  • 3 weeks later...

<?

$server = "SERVER_ADDRESS";

$user = "***";

$password = "***";

$con = mssql_connect($server, $user, $password);

if(!$con){

die("error Connecting to server ");

}

mssql_select_db("dbname", $con);

?>

for the others wuery on db, using same as mysql

mssql_query

mssql_fetch_array

etc...

 

chek on php.net

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.