X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5382FD1B4BE for ; Fri, 2 Jul 2004 18:37:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87502-04 for ; Fri, 2 Jul 2004 21:37:36 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 54F5DD1B4AF for ; Fri, 2 Jul 2004 18:37:33 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i62LbXZ3047280 for ; Fri, 2 Jul 2004 21:37:33 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i62LE14I042910 for pgsql-odbc@postgresql.org; Fri, 2 Jul 2004 21:14:01 GMT From: James Chin X-Newsgroups: comp.databases.postgresql.interfaces.odbc Subject: Re: ODBCv3 help... Date: Fri, 02 Jul 2004 17:18:55 -0400 Message-ID: References: X-Newsreader: Forte Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 118 X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 To: pgsql-odbc@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/41 X-Sequence-Number: 4174 Eric, After sending my last message, I recalled that you do have to set SQL_ATTR_ODBC_VERSION. This is done before you allocate a connection handle. ODBC 3.x Driver Managers and Drivers check the version of the ODBC spec for which the application is written for. You specify this with the SQLSetEnvAttr ODBC API call. Modify your app as follows: SQLHENV env; SQLHDBC dbc; SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); fprintf (stderr, "Allocated ENV\n"); /* Add the following.*/ SQLSetEnvAttr (env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER); SQLAllocHandle( SQL_HANDLE_DBC, env, &dbc ); fprintf (stderr, "Allocated DBC\n"); I'd still recommend using SQLError to help determine what the problem is. Regards, James Chin OpenLink Software Inc. http://www.openlinksw.com Product Weblogs: Virtuoso: http://www.openlinksw.com/weblogs/virtuoso UDA: http://www.openlinksw.com/weblogs/uda Universal Data Access & Virtual Database Technology On 1 Jul 2004 13:04:45 -0700, ericgolson@gmail.com (Eric Olson) wrote: >my system is configured as follows: >Red Hat 8, postgreSQL 7.4.3, psqlodbc-07.03.0200, and unixODBC-2.2.9. > >I have been trying to get the following very simple code snippet >working but it always seg faults after connecting to the db....it >connects then if I try to execute a sql statement it seg faults or in >the below example just freeing the DBC handle will cause a seg >fault...am I missing something?? with the v2 calls to alloc handle and >free handle EVERYTHING works fine...I'm thinking maybe I didn't >configure something properly to use ODBCv3?: > >#include "sql.h" >#include "sqlext.h" >#include "stdio.h" >int main () { > > SQLHENV env; > SQLHDBC dbc; > SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); > > fprintf (stderr, "Allocated ENV\n"); > > SQLAllocHandle( SQL_HANDLE_DBC, env, &dbc ); > fprintf (stderr, "Allocated DBC\n"); > > SQLConnect( dbc, > (SQLCHAR*) "erictest", SQL_NTS, > (SQLCHAR* ) "olsoneg", SQL_NTS, > (SQLCHAR*) NULL, SQL_NTS ); > > fprintf (stderr, "Connected\n"); > > > SQLDisconnect( dbc ); > > SQLFreeHandle (SQL_HANDLE_DBC, dbc); > > SQLFreeHandle (SQL_HANDLE_ENV, env); > >} > > >However if I substitute with the V2 ODBC functions like that follows >then everything works: >#include "sql.h" >#include "sqlext.h" >#include "stdio.h" >int main () { > > SQLHENV env; > SQLHDBC dbc; > SQLAllocEnv (&env); > > fprintf (stderr, "Allocated ENV\n"); > > SQLAllocConnect (env, &dbc); > fprintf (stderr, "Allocated DBC\n"); > > SQLConnect( dbc, > (SQLCHAR*) "erictest", SQL_NTS, > (SQLCHAR* ) "olsoneg", SQL_NTS, > (SQLCHAR*) NULL, SQL_NTS ); > > fprintf (stderr, "Connected\n"); > > SQLDisconnect( dbc ); > > SQLFreeConnect (dbc); > > SQLFreeEnv (env); > >} > > >Any help on why the V2 calls work but the V3 don't would be GREATLY >appreciated...