Re: DB_DataObject: extrange behaviour with odbc

From: Date: Mon, 12 May 2003 15:48:01 +0000
Subject: Re: DB_DataObject: extrange behaviour with odbc
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5333@lists.php.net to get a copy of this message
Daniel Garcia wrote:
Hi, I'm using DataObject to handle the database data for a small website. I've tested it with local mySQL databases, with very good results. However, I'm trying now to access database through ODBC (ODBC manager runs on Win2K), and I'm getting strange results. 1) First, I did not manage to run the createTables.php to build the initial table classes and the database definition .ini file. It worked fine with: mysql://user:password@localhost/databasename but when the DSN was: odbc://user:password@myodbc
the files created  were really odd:    -6.php     .ini     .php     1.php
1024.php     Array.php     DB Error (empty file)
The odbc DSN uses the mysql ODBC driver. I tried to autogenerate the configuration files with another ODBC driver (Client Access for AS/400), and I got exactly the same extrange filenames.
It is likely that the pear DB driver for ODBC is not returning details of the tables as expected. - It's probably worth print_r'ing the tableinfo that is returned from $db->getInfo('tablename'); http://docs.akbkhome.com/pearcvs/DB_DataObject_Generator.html#_createTableList and comparing that to the results from the mysql connection.
2) Next I typed manually the table.php and myodbc.ini files, and the DB_DataObject class worked fine (tried select and update) but it throws a warning: Warning: parse_ini_file() [function.parse-ini-file.html]: Cannot open 'D:/www/includes/DataObjects/.ini' for reading in c: \php\pear\DB\DataObject.php on line 1080
Ah :) - since your odbc connection does not contain a database it can not read this from the dsn.. (and fails to load the table.ini/links)- the work around would be to set var $database="name"; I'm not sure if you can fudge the dsn to do odbc://user:password@myodbc/databasename if it works it may solve the generator. can you file it as a bug as well - noting that odbc does not set a database I will probably have to solve this with an ini setting for database name. Regards Alan
It looks for file .ini, when the file it should look for is (I guess) myodbc.ini. Renaming the myodbc.ini to .ini works. 3) Setting on the debug mode for the class shows that the queries and connections are successful.
At least its getting something right :)
Any hints are appreciated ! -- Daniel


« previous php.pear.general (#5333) next »