scottybwoy Posted August 31, 2007 Share Posted August 31, 2007 Hi All, Not posted in here for a while, and should probably post it in another section, but this forum is fast and the one of the best I know, well done everyone. Well back to my issue. I'm trying to connect to MSSQL Server 2005 using this code: <?php $dbh = odbc_connect("mri.local.mri-server", "user", "pass"); ?> And get this error : PHP 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 D:\Inetpub\wwwroot\testing\classes\template.inc on line 105 Is there any additional things I need to install or do? The php manual suggests that it requires additional libraries to be installed, but doesn't specify. Any pointers? Link to comment https://forums.phpfreaks.com/topic/67422-solved-odbc-connect-issue/ Share on other sites More sharing options...
vbnullchar Posted August 31, 2007 Share Posted August 31, 2007 look at your php.ini file then uncomment extension=mssql.dll Link to comment https://forums.phpfreaks.com/topic/67422-solved-odbc-connect-issue/#findComment-338462 Share on other sites More sharing options...
scottybwoy Posted August 31, 2007 Author Share Posted August 31, 2007 lol, i have been using mssql and it's functions for about a yr now, it is uncommented. But I want to use this odbc function to retrieve a list of tables in the db. How am I meant to call the dns. I have tried IP @ddy, domain.fqns_servername and localhost,port all return the same error. Link to comment https://forums.phpfreaks.com/topic/67422-solved-odbc-connect-issue/#findComment-338487 Share on other sites More sharing options...
scottybwoy Posted August 31, 2007 Author Share Posted August 31, 2007 --- BUMP! --- Link to comment https://forums.phpfreaks.com/topic/67422-solved-odbc-connect-issue/#findComment-338648 Share on other sites More sharing options...
lemmin Posted August 31, 2007 Share Posted August 31, 2007 Make sure that is the correct dsn name, you don't use the tns name. I assume you have it all set up, but whatever computer you are running the php on needs to have the odbc set up with the dsn you want to use. Link to comment https://forums.phpfreaks.com/topic/67422-solved-odbc-connect-issue/#findComment-338652 Share on other sites More sharing options...
scottybwoy Posted September 3, 2007 Author Share Posted September 3, 2007 Thanks, that done the trick, I just needed to set up a DNS name and now it's working fine. Thanks Link to comment https://forums.phpfreaks.com/topic/67422-solved-odbc-connect-issue/#findComment-340324 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.