Bug #581 Setting ADODB.Connection.DefaultDatabase fails
Submitted: 4 Jun 2003 3:15 Modified: 4 Jun 2003 15:02
Reporter: Harry von Borstel Email Updates:
Status: Closed Impact on me:
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.06 OS:Microsoft Windows (Windows)
Assigned to: Bugs System CPU Architecture:Any

[4 Jun 2003 3:15] Harry von Borstel
Using MyODBC with ADO (MSDASQL.1 provider).
Trying to switch to another database (catalog) setting the ADODB.Connection.DefaultDatabase property to the new database's name (e.g. 'dbname').
Sometimes this fails with Err.Number = 0x80004005 and con.Errors(0).Description like "[MySQL][ODBC 3.51 Driver]Unknown database 'dbnameµàxµðxµpyµ'"

How to repeat:
Create some databases on a host.
Connect to one of these DBs using ADO
Switch between the different DBs:

con.DefaultDatabase = "dbname"
con.DefaultDatabase = "test"
con.DefaultDatabase = "test2"

[4 Jun 2003 14:48] Venu Anuganti
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 

Hi !!

Thanks for the nice bug report. This is now fixed in Connector/ODBC 3.52.00 and 3.51.07. The reason for this is driver is not properly null terminating the db string before sending it to the server and thats why you are getting an error while setting it.

The quick work around for this is to send properly null terminated string from ADO.

[4 Jun 2003 23:46] Harry von Borstel
Hi Venu,

Thanks a lot for this very rapid fixing! I hope that the binaries will be available soon.

The quick work around for this is to send properly null terminated
string from ADO.

I tried this before (con.DefaultDatabase = "dbname" + chr(0)), but it had no effect. It seems that all of the string *excluded* the terminating null has been taken to an internal buffer.

Best regards,