ODBC - user-specified host/database name

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
chadman
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Mar 23, 2005 8:28 am

ODBC - user-specified host/database name

Post by chadman » Wed Mar 30, 2005 6:12 am

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?

ddaeschl
Knows some wx things
Knows some wx things
Posts: 41
Joined: Wed Oct 27, 2004 6:06 pm
Location: Western NY
Contact:

Post by ddaeschl » Wed Mar 30, 2005 1:00 pm

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.

chadman
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Mar 23, 2005 8:28 am

Post by chadman » Fri Apr 01, 2005 5:03 am

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

Post Reply