Page 1 of 1

ODBC - user-specified host/database name

Posted: Wed Mar 30, 2005 6:12 am
by chadman
I'm writing an app for school and it connects to a DB2 database, then displays the data in a given table.

I'm pretty sure that in java you can let the user specify the database name, like this:

String JDBC_DRIVER = "com.ibm.as400.access.AS400JDBCDriver";
String DATABASE_URL = "jdbc:as400://db2servername";

but that's using JDBC and not ODBC. Is there a way I can let the user specify the host name and database name in wxWidgets without having to do it in the System DSN?

Posted: Wed Mar 30, 2005 1:00 pm
by ddaeschl
The newer versions of wxDb have a connection string Open Function...

bool Open(const wxString &inConnectStr, bool failOnDataTypeUnsupported)

I am not sure the format of the strings, but the support is there. From everything i've read, if this function takes standard ODBC connection strings and not something that someone made up, it should work for you.

Posted: Fri Apr 01, 2005 5:03 am
by chadman
Ahh, yes! thanks! works great (once I got my hands on the right driver)

by the way, in case anyone wants to know or in case some one searches google, the db2 iseries connection string is this:

driver={Client Access ODBC Driver (32-bit)};System=xxxxx;Uid=xxxxx;Pwd=xxxxx

and the normal personal editional db2 connection string is this:

driver={IBM DB2 ODBC DRIVER};Database=xxxxx;hostname=xxxxx;port=50000;protocol=TCPIP;uid=xxxxx;pwd=xxxxx