[unixODBC-dev] Problem connecting to the DSN

Igor Korot ikorot01 at gmail.com
Sun Jun 5 18:27:09 BST 2016


Hi, (Nick),

I am trying to see why my program fails to connect.

First some setup:

[code]
igor at IgorDellGentoo ~ $ cat /etc/unixODBC/odbcinst.ini
[ODBC]
Trace=No
TraceFile=/tmp/sql.log
Pooling=No

[myodbc-5.2]
Description=MySQL ODBC 5.2 Driver
Driver=/usr/lib/libmyodbc5a.so
UsageCount=1

[freetds]
Description=Microsoft SQL Server
Driver=libtdsodbc.so
UsageCount=1


igor at IgorDellGentoo ~ $ cat /etc/unixODBC/odbc.ini
[ODBC Data Sources]
myodbc-5.2-test=MySQL ODBC 5.2 Driver Testing DSN
freetds=Microsoft SQL Server

[myodbc-5.2-test]
Description=MySQL ODBC 5.2 Driver Testing DSN
Driver=myodbc-5.2
Socket=/var/run/mysqld/mysqld.sock
Server=localhost
User=root
Database=test
Option=3

[freetds]
Description=Microsoft SQL Server
Driver=freetds
Server=192.168.1.4
Port=1433
Database=draft
[/code]

And this is the gdb log of my program execution. Trying to connect to
mySQL myodnc-5.2-test:

[code]
igor at IgorDellGentoo ~/dbhandler/Debug/dbhandler $ gdb dbhandler
GNU gdb (Gentoo 7.10.1 vanilla) 7.10.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from dbhandler...done.
(gdb) break database_odbc.cpp:407
No source file named database_odbc.cpp.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (database_odbc.cpp:407) pending.
(gdb) run
Starting program: /home/igor/dbhandler/Debug/dbhandler/dbhandler
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, ODBCDatabase::Connect (this=0x7937f0,
selectedDSN=L"myodbc-5.2-test", errorMsg=std::vector of length 0,
capacity 0) at /home/igor/dbhandler/libodbc/database_odbc.cpp:407
407                         ret = SQLDriverConnect( m_hdbc, m_handle,
connectStrIn, SQL_NTS, m_connectString, 1024, &OutConnStrLen, options
);
(gdb) print connectStrIn
$1 = {68, 83, 78, 61, 109, 121, 111, 100, 98, 99, 45, 53, 46, 50, 45,
116, 101, 115, 116, 59, 68, 114, 105, 118, 101, 114, 61, 102, 114,
101, 101, 116, 100, 115, 0 <repeats 476 times>}
(gdb) print (SQLWCHAR *)connectStrIn
$2 = (SQLWCHAR *) 0x7fffffffb5f0
(gdb) n
408                         if( ret != SQL_SUCCESS && ret !=
SQL_SUCCESS_WITH_INFO )
(gdb) print ret
$3 = -1
(gdb)
[/code]

Do you see anything wrong with my .ini files?

Thank you.


More information about the unixODBC-dev mailing list