Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #240263 > unrolled thread

Postgresql ODBC driver not found

Started byPierre Couderc <pierre@couderc.eu>
First post2021-09-22 11:20 +0200
Last post2021-09-26 14:00 +0200
Articles 11 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  Postgresql ODBC driver not found Pierre Couderc <pierre@couderc.eu> - 2021-09-22 11:20 +0200
    Re: Postgresql ODBC driver not found Henning Follmann <hfollmann@itcfollmann.com> - 2021-09-22 15:40 +0200
      Re: Postgresql ODBC driver not found Pierre Couderc <pierre@couderc.eu> - 2021-09-23 08:50 +0200
        Re: Postgresql ODBC driver not found Henning Follmann <hfollmann@itcfollmann.com> - 2021-09-23 14:20 +0200
          Re: Postgresql ODBC driver not found Gregory Seidman <gsslist+debian@anthropohedron.net> - 2021-09-23 18:00 +0200
            Re: Postgresql ODBC driver not found Pierre Couderc <pierre@couderc.eu> - 2021-09-24 00:00 +0200
              Re: Postgresql ODBC driver not found Henning Follmann <hfollmann@itcfollmann.com> - 2021-09-24 17:40 +0200
                Re: Postgresql ODBC driver not found Pierre Couderc <pierre@couderc.eu> - 2021-09-25 09:20 +0200
                  Re: Postgresql ODBC driver not found Henning Follmann <hfollmann@itcfollmann.com> - 2021-09-25 15:50 +0200
                    Re: Postgresql ODBC driver not found Pierre Couderc <pierre@couderc.eu> - 2021-09-26 00:20 +0200
                      Re: Postgresql ODBC driver not found Henning Follmann <hfollmann@itcfollmann.com> - 2021-09-26 14:00 +0200

#240263 — Postgresql ODBC driver not found

FromPierre Couderc <pierre@couderc.eu>
Date2021-09-22 11:20 +0200
SubjectPostgresql ODBC driver not found
Message-ID<D06A1-4sB-5@gated-at.bofh.it>
It is here I see it/them with:

odbcinst -q -d

but not with :

   SQLHENV env;
   SQLCHAR driver[256];
   SQLCHAR attr[256];
   SQLSMALLINT driver_ret;
   SQLSMALLINT attr_ret;
   SQLUSMALLINT direction;
   SQLRETURN ret;
   SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
   SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);

   direction = SQL_FETCH_FIRST;
   while(SQL_SUCCEEDED(ret = SQLDrivers(env, direction,
                                        driver, sizeof(driver), &driver_ret,
                                        attr, sizeof(attr), &attr_ret))) {
     direction = SQL_FETCH_NEXT;
     printf("%s - %s\n", driver, attr);
     if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n");
   }

What do I miss...?

(under debian bulllseye linked with libodbc)

Thanks in advance

PC

[toc] | [next] | [standalone]


#240268

FromHenning Follmann <hfollmann@itcfollmann.com>
Date2021-09-22 15:40 +0200
Message-ID<D0aDD-6Ml-3@gated-at.bofh.it>
In reply to#240263
On Wed, Sep 22, 2021 at 11:07:28AM +0200, Pierre Couderc wrote:
> It is here I see it/them with:
> 
> odbcinst -q -d
> 
> but not with :
> 
>   SQLHENV env;
>   SQLCHAR driver[256];
>   SQLCHAR attr[256];
>   SQLSMALLINT driver_ret;
>   SQLSMALLINT attr_ret;
>   SQLUSMALLINT direction;
>   SQLRETURN ret;
>   SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
>   SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
> 
>   direction = SQL_FETCH_FIRST;
>   while(SQL_SUCCEEDED(ret = SQLDrivers(env, direction,
>                                        driver, sizeof(driver), &driver_ret,
>                                        attr, sizeof(attr), &attr_ret))) {
>     direction = SQL_FETCH_NEXT;
>     printf("%s - %s\n", driver, attr);
>     if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n");
>   }
> 
> What do I miss...?
>

The ability to clearly describe your problem!

What did you do?
  I assume you wrote some c code.
  Did you compile it? And if so, how?
  You installed odbcunix I assume.
  How did you configure it?
  What is the output of "odbcinst -q -d"?

What did you expect?

What did not work?
 Include logs, error messages.

What did you do to solve your problem so far?

-H






-- 
Henning Follmann           | hfollmann@itcfollmann.com

[toc] | [prev] | [next] | [standalone]


#240282

FromPierre Couderc <pierre@couderc.eu>
Date2021-09-23 08:50 +0200
Message-ID<D0qIp-89R-1@gated-at.bofh.it>
In reply to#240268
Thank you very much!

See below :

On 9/22/21 3:37 PM, Henning Follmann wrote:
> On Wed, Sep 22, 2021 at 11:07:28AM +0200, Pierre Couderc wrote:
>> It is here I see it/them with:
>>
>> odbcinst -q -d
>>
>> but not with :
>>
>>    SQLHENV env;
>>    SQLCHAR driver[256];
>>    SQLCHAR attr[256];
>>    SQLSMALLINT driver_ret;
>>    SQLSMALLINT attr_ret;
>>    SQLUSMALLINT direction;
>>    SQLRETURN ret;
>>    SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
>>    SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
>>
>>    direction = SQL_FETCH_FIRST;
>>    while(SQL_SUCCEEDED(ret = SQLDrivers(env, direction,
>>                                         driver, sizeof(driver), &driver_ret,
>>                                         attr, sizeof(attr), &attr_ret))) {
>>      direction = SQL_FETCH_NEXT;
>>      printf("%s - %s\n", driver, attr);
>>      if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n");
>>    }
>>
>> What do I miss...?
>>
> The ability to clearly describe your problem!
Sorry I tried to be minimum... But here are more details?
>
> What did you do?
>    I assume you wrote some c code.
Yes, this  code above is written in c (c++ in fact but I have simplified).
>    Did you compile it? And if so, how?
Yes, with default tools (gcc under debian bulllseye linked with libodbc)
>    You installed odbcunix I assume.
>    How did you configure it?
Correctly.
>    What is the output of "odbcinst -q -d"?

Correct :

[PostgreSQL ANSI]
[PostgreSQL Unicode]

> What did you expect?
That my c program produces the same list
>
> What did not work?
>   Include logs, error messages.

Logs and error messages : none (This is the heart of the problem)

>
> What did you do to solve your problem so far?
>
I have reduced my problem - which is much more complex - to the simplest 
test prograam.

And I ask for help, as I have no more idea after many hours.

[toc] | [prev] | [next] | [standalone]


#240286

FromHenning Follmann <hfollmann@itcfollmann.com>
Date2021-09-23 14:20 +0200
Message-ID<D0vRM-35x-7@gated-at.bofh.it>
In reply to#240282
On Thu, Sep 23, 2021 at 08:44:42AM +0200, Pierre Couderc wrote:
> Thank you very much!
> 
> See below :
> 
> On 9/22/21 3:37 PM, Henning Follmann wrote:
> > On Wed, Sep 22, 2021 at 11:07:28AM +0200, Pierre Couderc wrote:
> > > It is here I see it/them with:
> > > 
> > > odbcinst -q -d
> > > 
> > > but not with :
> > > 
> > >    SQLHENV env;
> > >    SQLCHAR driver[256];
> > >    SQLCHAR attr[256];
> > >    SQLSMALLINT driver_ret;
> > >    SQLSMALLINT attr_ret;
> > >    SQLUSMALLINT direction;
> > >    SQLRETURN ret;
> > >    SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
> > >    SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
> > > 
> > >    direction = SQL_FETCH_FIRST;
> > >    while(SQL_SUCCEEDED(ret = SQLDrivers(env, direction,
> > >                                         driver, sizeof(driver), &driver_ret,
> > >                                         attr, sizeof(attr), &attr_ret))) {
> > >      direction = SQL_FETCH_NEXT;
> > >      printf("%s - %s\n", driver, attr);
> > >      if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n");
> > >    }
> > > 
> > > What do I miss...?
> > > 
> > The ability to clearly describe your problem!
> Sorry I tried to be minimum... But here are more details?

Not sorry, but what do you expect? That everybody has a magic crystal bowl to
fill in missing information?

> > 
> > What did you do?
> >    I assume you wrote some c code.
> Yes, this  code above is written in c (c++ in fact but I have simplified).

That is not c code. This does not compile.
Provide a minimum example which compiles, at least.


> >    Did you compile it? And if so, how?
> Yes, with default tools (gcc under debian bulllseye linked with libodbc)

Are you kidding me? That is not additional information. Just you
being condescending.
Strike one.

> >    You installed odbcunix I assume.
> >    How did you configure it?
> Correctly.

Really? REALLY?
Strike two.

> >    What is the output of "odbcinst -q -d"?
> 
> Correct :
> 
> [PostgreSQL ANSI]
> [PostgreSQL Unicode]
>

all right that is something.

can you please connect to your database with:

isql "PostgreSQL Unicode" <user> <password>

and perform a minimum check like:
select 1;


> > What did you expect?
> That my c program produces the same list
> > 
> > What did not work?
> >   Include logs, error messages.
> 
> Logs and error messages : none (This is the heart of the problem)
> 
> > 
> > What did you do to solve your problem so far?
> > 
> I have reduced my problem - which is much more complex - to the simplest
> test prograam.
> 
> And I ask for help, as I have no more idea after many hours.
> 
>

You know this is a debian user mailing list, right?

but anyway...


-H

-- 
Henning Follmann           | hfollmann@itcfollmann.com

[toc] | [prev] | [next] | [standalone]


#240291

FromGregory Seidman <gsslist+debian@anthropohedron.net>
Date2021-09-23 18:00 +0200
Message-ID<D0ziG-51U-7@gated-at.bofh.it>
In reply to#240286
On Thu, Sep 23, 2021 at 08:18:45AM -0400, Henning Follmann wrote:
> On Thu, Sep 23, 2021 at 08:44:42AM +0200, Pierre Couderc wrote:
> > Thank you very much!
> > 
> > See below :
> > 
> > On 9/22/21 3:37 PM, Henning Follmann wrote:
> > > On Wed, Sep 22, 2021 at 11:07:28AM +0200, Pierre Couderc wrote:
> > > > It is here I see it/them with:
> > > > 
> > > > odbcinst -q -d
> > > > 
> > > > but not with :
> > > > 
> > > >    SQLHENV env;
> > > >    SQLCHAR driver[256];
> > > >    SQLCHAR attr[256];
> > > >    SQLSMALLINT driver_ret;
> > > >    SQLSMALLINT attr_ret;
> > > >    SQLUSMALLINT direction;
> > > >    SQLRETURN ret;
> > > >    SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
> > > >    SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
> > > > 
> > > >    direction = SQL_FETCH_FIRST;
> > > >    while(SQL_SUCCEEDED(ret = SQLDrivers(env, direction,
> > > >                                         driver, sizeof(driver), &driver_ret,
> > > >                                         attr, sizeof(attr), &attr_ret))) {
> > > >      direction = SQL_FETCH_NEXT;
> > > >      printf("%s - %s\n", driver, attr);
> > > >      if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n");
> > > >    }
> > > > 
> > > > What do I miss...?

I don't see where you ask for the PostgreSQL ODBC connection in particular.
Maybe I'm the one missing something?

> > > The ability to clearly describe your problem!
> > Sorry I tried to be minimum... But here are more details?
> 
> Not sorry, but what do you expect? That everybody has a magic crystal
> bowl to fill in missing information?

Hey, ease up. Missing information makes it harder to diagnose the issue,
but there is no need to be rude about it.

[...]
> > >    Did you compile it? And if so, how?
> > Yes, with default tools (gcc under debian bulllseye linked with libodbc)
> 
> Are you kidding me? That is not additional information. Just you
> being condescending.
> Strike one.
> 
> > >    You installed odbcunix I assume.
> > >    How did you configure it?
> > Correctly.
> 
> Really? REALLY?
> Strike two.

Wow, seriously rude.

[...]
> can you please connect to your database with:
> 
> isql "PostgreSQL Unicode" <user> <password>
> 
> and perform a minimum check like:
> select 1;
[...]

That's helpful, and I look forward to seeing the response to this.

> -H
> 
> -- 
> Henning Follmann           | hfollmann@itcfollmann.com

--Gregory

[toc] | [prev] | [next] | [standalone]


#240292

FromPierre Couderc <pierre@couderc.eu>
Date2021-09-24 00:00 +0200
Message-ID<D0EV4-8oQ-7@gated-at.bofh.it>
In reply to#240291
Thenk you, Henning, thank you Gregory .

On 9/23/21 5:49 PM, Gregory Seidman wrote:
> On Thu, Sep 23, 2021 at 08:18:45AM -0400, Henning Follmann wrote:
>>
> I don't see where you ask for the PostgreSQL ODBC connection in particular.
> Maybe I'm the one missing something?
You are right, I am not trying to connect (not soon) but trying to get 
the list of available drivers !
>    
>
>> isql "PostgreSQL Unicode" <user> <password>
>>
>> and perform a minimum check like:
>> select 1;
>
SQL> select 1
+------------+
| ?column?   |
+------------+
| 1          |
+------------+
SQLRowCount returns 1
1 rows fetched

SQL> quit


unixodbc seems to work...

I put here the full c++ source and the full result :


#include <iostream>
#include <string>
#include <stdio.h>
#pragma GCC diagnostic ignored "-Wendif-labels"
#pragma GCC diagnostic ignored "-Wwrite-strings"

#define TDBG clock_t ttdbg=clock();float 
ftdbg=((float)ttdbg)/CLOCKS_PER_SEC;
#define DBG_(fmt, args...) {TDBG fprintf(stdout,string( 
string("D%5.1f:ln %d:%s(): ")+fmt).c_str(),ftdbg,__LINE__, __func__, 
##args);fflush(stdout);}

using namespace std;
extern "C"
{
#include <sql.h>
#include <sqlext.h>
}
int main(int argc, char **argv)
{
     DBG_("Start  : Compile time :  __DATE__ __TIME__\n");
     SQLHENV env;
     SQLCHAR driver[256];
     SQLCHAR attr[256];
     SQLSMALLINT driver_ret;
     SQLSMALLINT attr_ret;
     SQLUSMALLINT direction;
     SQLRETURN ret;

     SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
     SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);

     cout << env<<endl;
     direction = SQL_FETCH_FIRST;
     while(SQL_SUCCEEDED(ret = SQLDrivers(env, direction,
                                             driver, sizeof(driver), 
&driver_ret,
                                             attr, sizeof(attr), 
&attr_ret))) {
             direction = SQL_FETCH_NEXT;
             printf("%s - %s\n", driver, attr);
             if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata 
truncation\n");
     }
     return 0;
}


Result :

nous@pcouderc:~/projets/tttt/build$ ./ttest
D  0.0:ln 33:main(): Start  : Compile time :  __DATE__ __TIME__
0x55b0948ffed0
nous@pcouderc:~/projets/tttt/build$

and meson.build for completeness :

project('ttest','cpp', default_options : ['cpp_std=c++17'],
         version : '0.1')
cpp = meson.get_compiler('cpp')
libiodbc_dep = cpp.find_library('libiodbc')
incdirs = include_directories('/usr/include/iodbc')
executable('ttest', 'main.cpp', dependencies : [libiodbc_dep], 
include_directories : incdirs)

[toc] | [prev] | [next] | [standalone]


#240313

FromHenning Follmann <hfollmann@itcfollmann.com>
Date2021-09-24 17:40 +0200
Message-ID<D0VsS-1EF-7@gated-at.bofh.it>
In reply to#240292
On Thu, Sep 23, 2021 at 11:55:00PM +0200, Pierre Couderc wrote:
> Thenk you, Henning, thank you Gregory .
> 
> On 9/23/21 5:49 PM, Gregory Seidman wrote:
> > On Thu, Sep 23, 2021 at 08:18:45AM -0400, Henning Follmann wrote:
> > > 
> > I don't see where you ask for the PostgreSQL ODBC connection in particular.
> > Maybe I'm the one missing something?
> You are right, I am not trying to connect (not soon) but trying to get the
> list of available drivers !
> > 
> > > isql "PostgreSQL Unicode" <user> <password>
> > > 
> > > and perform a minimum check like:
> > > select 1;
> > 
> SQL> select 1
> +------------+
> | ?column?   |
> +------------+
> | 1          |
> +------------+
> SQLRowCount returns 1
> 1 rows fetched
> 
> SQL> quit
> 
> 
> unixodbc seems to work...

yes

> 
> I put here the full c++ source and the full result :
>

and I see you do not do any error checking.
This would be a first step to find out where it fails.

I added some code...

> 
> #include <iostream>
> #include <string>
> #include <stdio.h>
> #pragma GCC diagnostic ignored "-Wendif-labels"
> #pragma GCC diagnostic ignored "-Wwrite-strings"
> 
> #define TDBG clock_t ttdbg=clock();float
> ftdbg=((float)ttdbg)/CLOCKS_PER_SEC;
> #define DBG_(fmt, args...) {TDBG fprintf(stdout,string( string("D%5.1f:ln
> %d:%s(): ")+fmt).c_str(),ftdbg,__LINE__, __func__, ##args);fflush(stdout);}
> 
> using namespace std;
> extern "C"
> {
> #include <sql.h>
> #include <sqlext.h>
> }
> int main(int argc, char **argv)
> {
>     DBG_("Start  : Compile time :  __DATE__ __TIME__\n");
>     SQLHENV env;
>     SQLCHAR driver[256];
>     SQLCHAR attr[256];
>     SQLSMALLINT driver_ret;
>     SQLSMALLINT attr_ret;
>     SQLUSMALLINT direction;
>     SQLRETURN ret;
>
   ret = 
>     SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
   if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) { {
   /* most likely the odbc env is not set up properly
      write error message and bail */
      cerr << "Failed to allocate handle" << endl;
      return -1;
      }

      ret =
>     SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
  /* again, even this function is not guaranteed to succeed
     test ! */
> 
>     cout << env<<endl;
>     direction = SQL_FETCH_FIRST;

/* again here you just use the return value for your loop
   I think it might be helpful to test for SQL_SUCCESS and
   in case it fails to actually handle the error
   for error codes check:
   https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqldrivers-function?view=sql-server-ver15
   */
   
>     while(SQL_SUCCEEDED (ret = SQLDrivers(env, direction,
>                                             driver, sizeof(driver),
> &driver_ret,
>                                             attr, sizeof(attr), &attr_ret)))
> {
>             direction = SQL_FETCH_NEXT;
>             printf("%s - %s\n", driver, attr);
>             if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n");
>     }
>     return 0;
> }
> 
> 
> Result :
> 
> nous@pcouderc:~/projets/tttt/build$ ./ttest
> D  0.0:ln 33:main(): Start  : Compile time :  __DATE__ __TIME__
> 0x55b0948ffed0
> nous@pcouderc:~/projets/tttt/build$
> 
> and meson.build for completeness :
> 
> project('ttest','cpp', default_options : ['cpp_std=c++17'],
>         version : '0.1')
> cpp = meson.get_compiler('cpp')
> libiodbc_dep = cpp.find_library('libiodbc')
> incdirs = include_directories('/usr/include/iodbc')
> executable('ttest', 'main.cpp', dependencies : [libiodbc_dep],
> include_directories : incdirs)
> 
> 
> 

-- 
Henning Follmann           | hfollmann@itcfollmann.com

[toc] | [prev] | [next] | [standalone]


#240337

FromPierre Couderc <pierre@couderc.eu>
Date2021-09-25 09:20 +0200
Message-ID<D1a8x-2fU-5@gated-at.bofh.it>
In reply to#240313
On 9/24/21 5:31 PM, Henning Follmann wrote:
>
> and I see you do not do any error checking.
> This would be a first step to find out where it fails.
>
> I added some code...
>

You hare fully right, I have corrected, but I have the same result and 
no more idea.. :

nous@pcouderc:~/projets/tttt/build$ ./ttest
D  0.0:ln 19:main(): Start  : Compile time : Sep 25 2021 09:03:28

0x55cee70a5ed0



nous@pcouderc:~/projets/tttt/build$ cat ../main.cpp
#include <iostream>
#include <string>
#include <stdio.h>
#pragma GCC diagnostic ignored "-Wendif-labels"
#pragma GCC diagnostic ignored "-Wwrite-strings"


#define TDBG clock_t ttdbg=clock();float 
ftdbg=((float)ttdbg)/CLOCKS_PER_SEC;
#define DBG_(fmt, args...) {TDBG fprintf(stdout,string( 
string("D%5.1f:ln %d:%s(): ")+fmt).c_str(),ftdbg,__LINE__, __func__, 
##args);fflush(stdout);}

using namespace std;
extern "C"
{
#include <sql.h>
#include <sqlext.h>
}
int main(int argc, char **argv)
{
     DBG_("Start  : Compile time : " __DATE__" " __TIME__"\n");
     SQLHENV env;
     SQLCHAR driver[256];
     SQLCHAR attr[256];
     SQLSMALLINT driver_ret;
     SQLSMALLINT attr_ret;
     SQLUSMALLINT direction;
     SQLRETURN ret;

     ret=SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
     if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) {
             cerr << "Failed to allocate handle" << endl;
             return -1;
     }
     ret=SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) 
SQL_OV_ODBC3, 0);
     if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) {
             cerr << "Failed SQLSetEnvAttr" << endl;
             return -1;
     }
     cout << env<<endl;
     direction = SQL_FETCH_FIRST;
     while(1)
     {
     ret = SQLDrivers(env, direction,
                                             driver, sizeof(driver), 
&driver_ret,
                                             attr, sizeof(attr), &attr_ret);
             if(ret==SQL_NO_DATA) break;
             printf("%s - %s\n", driver, attr);
             if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata 
truncation\n");
             direction = SQL_FETCH_NEXT;
     }
     return 0;
}

[toc] | [prev] | [next] | [standalone]


#240346

FromHenning Follmann <hfollmann@itcfollmann.com>
Date2021-09-25 15:50 +0200
Message-ID<D1gdX-64S-7@gated-at.bofh.it>
In reply to#240337
On Sat, Sep 25, 2021 at 09:16:33AM +0200, Pierre Couderc wrote:
> 
> On 9/24/21 5:31 PM, Henning Follmann wrote:
> > 
> > and I see you do not do any error checking.
> > This would be a first step to find out where it fails.
> > 
> > I added some code...
> > 
> 
> You hare fully right, I have corrected, but I have the same result and no
> more idea.. :

I do not have much time this weekend, but I will try to set up my
computer to reproduce your setup  - maybe on Monday ...

In the meanwhile a few thoughts,
have you tried to use the odbc lib from unixodbc instead of
libiodbc?

Another thing I have myself no clue but, what happens if you do
not set the odbc version?

And just one thought about your loop:

try
do {
/* in there look at SQLSTATE
   for anything other than SQL_SUCCESS
   I am concerned that SQL_NO_DATA is
   not a reliable break indicator */



}while (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO)

> 
> nous@pcouderc:~/projets/tttt/build$ ./ttest
> D  0.0:ln 19:main(): Start  : Compile time : Sep 25 2021 09:03:28
> 
> 0x55cee70a5ed0
> 
> 
> 
> nous@pcouderc:~/projets/tttt/build$ cat ../main.cpp
> #include <iostream>
> #include <string>
> #include <stdio.h>
> #pragma GCC diagnostic ignored "-Wendif-labels"
> #pragma GCC diagnostic ignored "-Wwrite-strings"
> 
> 
> #define TDBG clock_t ttdbg=clock();float
> ftdbg=((float)ttdbg)/CLOCKS_PER_SEC;
> #define DBG_(fmt, args...) {TDBG fprintf(stdout,string( string("D%5.1f:ln
> %d:%s(): ")+fmt).c_str(),ftdbg,__LINE__, __func__, ##args);fflush(stdout);}
> 
> using namespace std;
> extern "C"
> {
> #include <sql.h>
> #include <sqlext.h>
> }
> int main(int argc, char **argv)
> {
>     DBG_("Start  : Compile time : " __DATE__" " __TIME__"\n");
>     SQLHENV env;
>     SQLCHAR driver[256];
>     SQLCHAR attr[256];
>     SQLSMALLINT driver_ret;
>     SQLSMALLINT attr_ret;
>     SQLUSMALLINT direction;
>     SQLRETURN ret;
> 
>     ret=SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
>     if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) {
>             cerr << "Failed to allocate handle" << endl;
>             return -1;
>     }
>     ret=SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
>     if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) {
>             cerr << "Failed SQLSetEnvAttr" << endl;
>             return -1;
>     }
>     cout << env<<endl;
>     direction = SQL_FETCH_FIRST;
>     while(1)
>     {
>     ret = SQLDrivers(env, direction,
>                                             driver, sizeof(driver),
> &driver_ret,
>                                             attr, sizeof(attr), &attr_ret);
>             if(ret==SQL_NO_DATA) break;
>             printf("%s - %s\n", driver, attr);
>             if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n");
>             direction = SQL_FETCH_NEXT;
>     }
>     return 0;
> }
> 
> 
> 


Have a nice weekend.
-H

-- 
Henning Follmann           | hfollmann@itcfollmann.com

[toc] | [prev] | [next] | [standalone]


#240357

FromPierre Couderc <pierre@couderc.eu>
Date2021-09-26 00:20 +0200
Message-ID<D1obv-2N9-3@gated-at.bofh.it>
In reply to#240346
On 9/25/21 3:46 PM, Henning Follmann wrote:
>
> have you tried to use the odbc lib from unixodbc instead of
> libiodbc?
>

I think you are right on many other points...

But particularly on this one !

I did remove libodbc2-dev and install unixodbc-dev and now it is OK...!!

Wow !

Thank you very much.

Let us have a Sunday without any odbc...

PC

[toc] | [prev] | [next] | [standalone]


#240396

FromHenning Follmann <hfollmann@itcfollmann.com>
Date2021-09-26 14:00 +0200
Message-ID<D1AZ4-2v9-9@gated-at.bofh.it>
In reply to#240357
On Sun, Sep 26, 2021 at 12:10:39AM +0200, Pierre Couderc wrote:
> 
> On 9/25/21 3:46 PM, Henning Follmann wrote:
> > 
> > have you tried to use the odbc lib from unixodbc instead of
> > libiodbc?
> > 
> 
> I think you are right on many other points...
> 
> But particularly on this one !
> 
> I did remove libodbc2-dev and install unixodbc-dev and now it is OK...!!
> 
> Wow !
> 
> Thank you very much.
> 
> Let us have a Sunday without any odbc...
> 
> PC
>


I am glad this worked out.
Now I wonder if we should file a bug report against the lib?


-H

-- 
Henning Follmann           | hfollmann@itcfollmann.com

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web