Bonjour,

j ai un souci avec soci. Mon but, est d utiliser un API (soci) pour me connecter a une base oracle en utilisant ODBC.
J ai donc installer soci (visaul studio). Dans la solution, il y a deja des pg de test sur les differents connecteur(ODBC,ORACLE,POSTGRES,...)

J ai donc pris un projet de test pour utiliser ODBC et me connecter a Oracle.
Je me suis apercu que j obtient une erreur lorque j execute 2 fois de suite la fonction SQLDriverConnect . Est ce normal ???
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
             rc = SQLDriverConnect(hdbc_, NULL, // windows handle
                          (SQLCHAR *)connectString.c_str(),
                          (SQLSMALLINT)connectString.size(),
                          outConnString, 1024,
                          &strLength, SQL_DRIVER_NOPROMPT);
 
           //Ici rc= 0 donc tout marche bien 
 
	 rc = SQLDriverConnect(hdbc_, NULL, // windows handle
                          (SQLCHAR *)connectString.c_str(),
                          (SQLSMALLINT)connectString.size(),
                          outConnString, 1024,
                          &strLength, SQL_DRIVER_NOPROMPT);
            //Ici rc= -1 donc ERROR
 
    if (is_odbc_error(rc))
    {
        throw odbc_soci_error(SQL_HANDLE_DBC, hdbc_,
                         "Error Connecting to database");
    }
Ensuite le projet de test est tel que l on a
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
 void run(bool dbSupportsTransactions = true)
    {
        std::cout<<"\nSOCI Common Tests:\n\n";
 
        test1();
        test2();
        test3();
        ....
C est moi qui est rajoute 2 fois la fonction rc = SQLDriverConnect(..).
Normalement, elle n y est qu une seule fois.
Ce qui implique, que le test1() va reussir mais pas test2().
Puisque la fonction SQLDriverConnect va etre appele une 2 ieme fois.

Si quelqu un a une idee, je suis preneur.