Mac OS X 10.5 : odbc_connect( ) error code IM002 problem with MySQL

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

 



Hello,

I've already spent quite some time trying to solve ths one, hopefully some-one here can lend me a hand.

I'm trying to set up a LAMP configuration, but on a Mac (so actually a MAMP ...). I have a MacBook Pro, Mac OS X 10.5.5, built-in Apache server and built-in PHP module ( phpinfo says it is PHP 5.2.6 on Darwin kernel 9.5.0). MySQL is the 5.1 Community version.

I want to use the ODBC connection in order to clearly separate data from UI.
So I've set up an ODBC connection (System DSN called "THUIS") using the Mac ODBC Administrator, and tested the link - works fine ( did the ODBC test with trace, worked, trace file yielded all zero's ).
I connected to the database using OpenOffice Base through ODBC - works fine.

Then I tried a simple PHP-script - and this fails :

Warning: odbc_connect() [function.odbc-connect]: SQL error: [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded, SQL state IM002 in SQLConnect in /Users/bertaerts/Documents/Apache-PHP/DB_thuis/connect.php on line 6
Could not connect to ODBC source THUIS

The script is :
====== start of script =========
<?php	// connect to database

putenv("ODBCINI=/Library/ODBC/odbc.ini");

phpinfo() ;
//$cnx = odbc_connect( 'THUIS' , 'root', '**********' ) or die("Could not connect to ODBC source THUIS");

$cnx = odbc_connect("DRIVER={MySQL ODBC 5.1 Driver};DATABASE=thuis;SERVER=localhost","root","**********") or die("Could not connect to ODBC source THUIS");

?>
==== end of script =========

Note: I've first tried the commented line of code, but that yielded a different error, IM003 ( Warning: odbc_connect() [function.odbc-connect]: SQL error: [iODBC][Driver Manager]Specified driver could not be loaded, SQL state IM003 in SQLConnect in /Users/bertaerts/Documents/Apache-PHP/DB_thuis/connect.php on line 4
Could not connect to ODBC source THUIS )

Surfing the Internet didn't return anything close to this configuration, or this problem.

Any-one who has a clue of what is going wrong here, or to what I'm doing wrong ?

Thanks in advance,

Bert.


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux