Reputation: 509
I'm trying to figure out the connection string to connect to a remote DB2 using the C DB2 API (and odbc). So far I've tried with different options without success. The documentation is not clear at the second parameter of SQLConnect when defining the data base name.
SQLConnect(hdbc, "hostname/dbname", SQL_NTS, "user", SQL_NTS, "pass", SQL_NTS);
SQLConnect(hdbc, "hostname:dbname", SQL_NTS, "user", SQL_NTS, "pass", SQL_NTS);
// just as jdbc format...
SQLConnect(hdbc, "odbc:db2://hostname/dbname", SQL_NTS, "user", SQL_NTS, "pass", SQL_NTS);
Thanks!
Upvotes: 0
Views: 528
Reputation: 11042
The SQLConnect()
function doesn't allow you to specify remote host details in the ServerName
parameter. You can only specify a database alias name here. If the database is on a remote server, you need to set up the connection parameters via the DB2 client (using the catalog node
and catalog database
commands).
However, you can use the SQLDriverConnect()
function and specify full details in the connection string like you are trying to do.
Upvotes: 2