Hello,
We are having troubles with unixodbc postgresql driver on CentOS 5 x86_64 on a Xen DomU. Digging through the net for a few days we couldn't find a solution, only some hints for a similar problem hitting other clients (php interpreter, for instance). Here is a sample program which demonstrates the problem: #include <stdio.h> #include <string.h> #include <sql.h> #include <sqlext.h> #include <string.h> void extract_error( char *fn, SQLHANDLE handle, SQLSMALLINT type) { SQLINTEGER i = 0; SQLINTEGER native; SQLCHAR state[ 7 ]; SQLCHAR text[256]; SQLSMALLINT len; SQLRETURN ret; fprintf(stderr, "\n" "The driver reported the following diagnostics whilst running " "%s\n\n", fn); do { ret = SQLGetDiagRec(type, handle, ++i, state, &native, text, sizeof(text), &len ); if (SQL_SUCCEEDED(ret)) printf("%s:%ld:%ld:%s\n", state, i, native, text); } while( ret == SQL_SUCCESS ); } main() { SQLHENV env; SQLHDBC dbc; SQLHSTMT stmt; SQLRETURN ret; /* ODBC API return status */ SQLSMALLINT columns; /* number of columns in result-set */ int row = 0; /* Allocate an environment handle */ SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); /* We want ODBC 3 support */ SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC2, 0); /* Allocate a connection handle */ SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc); char *szDSN = "TEMPLATE_1"; char *szUserName = "ayin"; char *szPassword = ""; /* Connect to the DSN mydsn */ ret = ::SQLConnect( dbc , (SQLCHAR *)szDSN , (SQLSMALLINT)strlen( szDSN ) , (SQLCHAR *)szUserName , (SQLSMALLINT)strlen( szUserName ) , (SQLCHAR *)szPassword , (SQLSMALLINT)strlen( szPassword ) ); /* Allocate a statement handle */ SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt); ret = SQLExecDirect(stmt, (SQLCHAR *)"select * from not_existing_table", SQL_NTS); if ( !SQL_SUCCEEDED(ret) ) extract_error( "Error SQLExecDirect" , stmt, SQL_HANDLE_STMT ); ret = ::SQLDisconnect( dbc ); } Here is some output with info about the environment: [dare@dev1 ~]$ uname -a Linux dev1.dev 2.6.18-5-xen-amd64 #1 SMP Tue Dec 18 23:16:23 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux [dare@dev1 ~]$ g++ -v Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,f77 --disable-libgcj --host=x86_64-redhat-linux Thread model: posix gcc version 3.4.6 20060404 (Red Hat 3.4.6-4) [dare@dev1 ~]$ built and installed unixODBC out of the box i.e. ./configure ./make ./make install then configured the "ini" files to setup the driver and DNS [dare@dev1 etc]$ pwd /usr/local/etc [dare@dev1 etc]$ more odbcinst.ini [PostgreSQL] Description = PostgreSQL driver for Linux Driver = /usr/local/lib/libodbcpsql.so Setup = /usr/local/lib/libodbcpsqlS.so FileUsage = 1 UsageCount = 1 [dare@dev1 etc]$ more odbc.ini [TEMPLATE_1] Driver = PostgreSQL Description = Postgres template db Trace = No TraceFile = /tmp/sql.log Database = template1 Servername = localhost UserName = ayin Password = Port = 5432 Protocol = 6.4 ReadOnly = No RowVersioning = No ShowSystemTables = No ShowOidColumn = No FakeOidIndex = No ConnSettings = ExtraSysTablePrefixes = [dare@dev1 etc]$ isql -v TEMPLATE1 ayin +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL> quit I cannot login to our development server to get a sample output right now. Does anyone know what this is all about? If you are in a position to work on it for money then we are willing to pay, but it'll have to be fast (we need to resolve it by July 11th). Thanks, --Amos -- Sent via sydpug mailing list ([hidden email]) To make changes to your subscription: http://www.postgresql.org/mailpref/sydpug |
On Fri, Jul 4, 2008 at 8:50 PM, Amos Shapira <[hidden email]> wrote:
> > We are having troubles with unixodbc postgresql driver on CentOS 5 > x86_64 on a Xen DomU. > > Here is a sample program which demonstrates the problem: > If I get a bit of free time later today, I'll try and reproduce your problem here. In the meantime, I recommend you post on one of the main postgresql lists with your problem, if you haven't already. Be sure to include an actual description of the issue, rather than just some source for a program which exhibits it. Also include exact versions for every piece of software involved (postgres, odbc driver, etc). There is a specific postgresql-ODBC list, but there's very little traffic on it. You might be better off posting on -general... Thanks, Charles Duffy -- Sent via sydpug mailing list ([hidden email]) To make changes to your subscription: http://www.postgresql.org/mailpref/sydpug |
2008/7/7 Charles Duffy <[hidden email]>:
> On Fri, Jul 4, 2008 at 8:50 PM, Amos Shapira <[hidden email]> wrote: > >> >> We are having troubles with unixodbc postgresql driver on CentOS 5 >> x86_64 on a Xen DomU. >> >> Here is a sample program which demonstrates the problem: >> > > If I get a bit of free time later today, I'll try and reproduce your > problem here. In the meantime, I recommend you post on one of the main > postgresql lists with your problem, if you haven't already. Be sure to > include an actual description of the issue, rather than just some > source for a program which exhibits it. Also include exact versions > for every piece of software involved (postgres, odbc driver, etc). Thanks for the advise. I'll try to provide more complete details if we can't solve it. > > There is a specific postgresql-ODBC list, but there's very little > traffic on it. You might be better off posting on -general... I subscribed and posted there but haven't heard anything back. In the meantime, we had some progress with a friend I contacted outside the list. Cheers, --Amos -- Sent via sydpug mailing list ([hidden email]) To make changes to your subscription: http://www.postgresql.org/mailpref/sydpug |
Free forum by Nabble | Edit this page |