[unixODBC-support] Cannot connect to SolidDB data source (SQLConnect fails, but isql works!!)

Fadil S fsutomo at gmail.com
Tue May 26 11:48:10 BST 2009


Hi all,

I am currently developing a (tailored) database client for IBM
SolidDB. My development environment is Fedora 10.

I have installed unixODBC. I have setup both odbc.ini and odbcinst.ini
(i'll copy paste them below).

However, when I try to use SQLConnect, somehow it won't connect me to
the specified DSN:

..some code..
...
//environment handle
sqlrc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
...
//Environment variable settings
sqlrc = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void *)SQL_OV_ODBC3, 0);
...
//Connection handle
sqlrc = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);

// connect (dsn, uid and pwd are already defined)
    sqlrc = SQLConnect(hdbc, dsn, SQL_NTS, (SQLCHAR*)uid, SQL_NTS,
(SQLCHAR*)pwd, SQL_NTS);
    if (sqlrc != SQL_SUCCESS || sqlrc != SQL_SUCCESS_WITH_INFO) {
        extract_error("SQLConnect error", hdbc, SQL_HANDLE_DBC);
        return 1;
    }

extract_error is a function that runs SQLGetDiagRec so that it can
receive the SQLState from the Driver Manager.

As the title of this email, SQLConnect fails. That is, it wont connect
to the DSN specified in the odbc.ini and the SQLGetDiagRec returns:
[IBM][CLI Driver] SQL1013N  The database alias name or database name
"TCP 2315" could not be found.  SQLSTATE=42705

here are my odbc and odbcinst:

- odbc.ini:
[TCP 2315]
Description=Logical name for solidDB ODBC connection
Driver=soliddb_odbc_driver

- odbcinst.ini:
[soliddb_odbc_driver]
Description=Solid ODBC Driver
Driver=/opt/solidDB/soliddb-6.3/bin/socl2x63.so
Setup=/opt/solidDB/soliddb-6.3/lib/solidodbcu.a

And, the weird thing is that when I do isql, it works.
[root at localhost Desktop]# isql "tcp 2315" dba dba
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>


So, any suggestions, comments advice? It will be greatly appreciated.

Thanks,
Fadil


More information about the unixODBC-support mailing list