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


Groups > linux.debian.user > #240292

Re: Postgresql ODBC driver not found

From Pierre Couderc <pierre@couderc.eu>
Newsgroups linux.debian.user
Subject Re: Postgresql ODBC driver not found
Date 2021-09-24 00:00 +0200
Message-ID <D0EV4-8oQ-7@gated-at.bofh.it> (permalink)
References <D06A1-4sB-5@gated-at.bofh.it> <D0aDD-6Ml-3@gated-at.bofh.it> <D0qIp-89R-1@gated-at.bofh.it> <D0vRM-35x-7@gated-at.bofh.it> <D0ziG-51U-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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)

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web