1 Replies - 73 Views - Last Post: 07 February 2012 - 06:42 AM Rate Topic: -----

Topic Sponsor:

#1 saman_47  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 06-February 12

libiodbc.so & libodbc.so error: cannot open shared object file.

Posted 07 February 2012 - 06:01 AM

Well, I found out what the problem was, seems I was giving the Oracle connection parameter in my source program.
the correct one should be SA_ODBC_CLIENT which is for SQL Server connections.

#include <cstdio>  // for printf
#include <SQLAPI.h> // main SQLAPI++ header
#include <iostream>


int main(int argc, char* argv[])
{
    SAConnection con; // create connection object
    
    try
    {
        // connect to database
        // in this example it is Oracle,
        // but can also be Sybase, Informix, DB2
        // SQLServer, InterBase, SQLBase and ODBC
        con.Connect(
            "test",     // database name
            "tester",   // user name
            "tester",   // password
            SA_ODBC_Client);

        printf("We are connected!\n");

        // Disconnect is optional
        // autodisconnect will ocur in destructor if needed
        con.Disconnect();

        printf("We are disconnected!\n");
    }
    catch(SAException &x)
    {
        // SAConnection::Rollback()
        // can also throw an exception
        // (if a network error for example),
        // we will be ready
        try
        {
            // on error rollback changes
            con.Rollback();
        }
        catch(SAException &)
        {
        }
        // print error message
        printf("%s\n", (const char*)x.ErrText());
    }
    
    return 0;
}



You know, another story just started to play as soon as this bug was identified.

Quote

g++ -c -Wall -O2 -DNDEBUG -I/usr/lib/SQLAPI/include -o dbConnection.obj dbConnection.cpp
bash-3.1# g++ dbConnection.obj -o dbConnection -L/usr/lib/SQLAPI/lib -s -lsqlapi -lc -lm -lcrypt -ldl
bash-3.1# export LD_LIBRARY_PATH=/usr/lib/SQLAPI/lib
bash-3.1# ./dbConnection

libiodbc.so: cannot open shared object file: No such file or directory
libiodbc.so.3: cannot open shared object file: No such file or directory
libiodbc.so.2: cannot open shared object file: No such file or directory
libodbc.so: cannot open shared object file: No such file or directory
libodbc.so.1: cannot open shared object file: No such file or directory

DBMS API Library loading fails
This library is a part of DBMS client installation, not SQLAPI++
Make sure DBMS client is installed and
this required library is available for dynamic loading


You know, I think the SQLServer Driver is not included in the SQLAPI++. So, I think I need to install the unixODBC driver for SQLServer. You got the same idea?, moreover, if the case is right, I think m not gonna need SQLAPI++ anymore, as I guess, you know, the ODBC manager driver automatically supports SQL APIs.

looking forward to hearing from you.
Saman

Is This A Good Question/Topic? 0
  • +

Replies To: libiodbc.so & libodbc.so error: cannot open shared object file.

#2 jimblumberg  Icon User is online

  • member icon

Reputation: 1892
  • View blog
  • Posts: 5,681
  • Joined: 25-December 09

Re: libiodbc.so & libodbc.so error: cannot open shared object file.

Posted 07 February 2012 - 06:42 AM

Please don't open a new topic for an existing question.

Topic Closed.

Jim
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1