Can't connect to SQL Server via ODBC

This is a discussion on Can't connect to SQL Server via ODBC within the PHP Language forums, part of the PHP Programming Forums category; I just installed PHP 5.1.4 with SQL Server 2005 on my laptop. PHP is running fine and so ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-11-2006
~john
 
Posts: n/a
Default Can't connect to SQL Server via ODBC

I just installed PHP 5.1.4 with SQL Server 2005 on my laptop. PHP is
running fine and so is SQL Server 2005. When I try to connect to SQL
Server from my my PHP code I get this error.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified, SQL state IM002 in SQLConnect in
C:\Inetpub\wwwroot\index.php on line 5

Here's my connection string that is causing the error

$connect_id = odbc_connect("Driver={SQL
Server};Server=mydbname;Database=myDB","myUser", "myPass");


Any idea what's wrong? This is driving me nutts.. I installed PHP on my
computer at home and had no problem connecting to SQL Server. It's like
this laptop is cursed.

Reply With Quote
  #2 (permalink)  
Old 07-12-2006
Jerry Stuckle
 
Posts: n/a
Default Re: Can't connect to SQL Server via ODBC

~john wrote:
> I just installed PHP 5.1.4 with SQL Server 2005 on my laptop. PHP is
> running fine and so is SQL Server 2005. When I try to connect to SQL
> Server from my my PHP code I get this error.
>
> Warning: odbc_connect() [function.odbc-connect]: SQL error:
> [Microsoft][ODBC Driver Manager] Data source name not found and no
> default driver specified, SQL state IM002 in SQLConnect in
> C:\Inetpub\wwwroot\index.php on line 5
>
> Here's my connection string that is causing the error
>
> $connect_id = odbc_connect("Driver={SQL
> Server};Server=mydbname;Database=myDB","myUser", "myPass");
>
>
> Any idea what's wrong? This is driving me nutts.. I installed PHP on my
> computer at home and had no problem connecting to SQL Server. It's like
> this laptop is cursed.
>


Do you have the ODBC database registered with the correct driver?

I don't use odbc much - but most of the time I've found when it works on
one machine but not another there's a problem with how the database
and/or driver is registered (if it is at all).

It could also be a difference driver in levels; never worked with the
SQL Server driver.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:08 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0