0

I am testing OpenDBX to connect to MSSQL server for a project on Ubuntu Linux. I am using C/C++ and eclipse CDT IDE. I built a simple test app from the OpenDBX Web page (below without error testing shown).

odbx_init( &handle, "mssql", "172.16.232.60", "" );
odbx_bind( handle, "testdb", "testuser", "testpwd", ODBX_BIND_SIMPLE );
odbx_finish( handle );

Problem: When I run the code from shell or Run->Run I see connection established with server (wireshark). When I attempt to run from with eclipse debugger the application blocks on odbx_init(...) and I see nothing go out on wireshark (SYN/ACK). I have gdb setup as sudo, (how to debug application as root in eclipse in Ubuntu?) I also use this same platform and setup to access network with sockets with other applications we are developing.

Any ideas on why odbx_init might be blocking from debugger?

One last bit of information to add. The issue does not occur when using the C++ API. Only the C API presents the issue described.


One last bit of information to add. The issue does not occur when using the C++ API. Only the C API presents the issue described.

Community
  • 1
  • 1
AAL
  • 1
  • 2

1 Answers1

0

I found a "work-around". Apparently the dynamic load of the library fails when in the eclipse GDB debug mode. To work around this at beginning of main I explicitly load the library and then close it immediately. This puts the library in memory so when the calls to the OpenDBX API are made the library is already resident. Not sure about all the low level details but this allows me to debug OpenDBX in eclipse. If anyone has a better explanation or fix/work-around please let me know. Here is the workaround code at beginning of main():

void *lib_handle_mssql;
lib_handle_mssql = dlopen("/usr/lib/opendbx/libmssqlbackend.so",RTLD_NOW);
if(!lib_handle_mssql)
{    
    // Bad, Bad, Bad...
    printf("%s\n",dlerror());
    exit(EXIT_FAILURE);
}
dlclose(lib_handle_mssql);
// Can now debug in eclipse IDE.
AAL
  • 1
  • 2