Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 63CB0633427 for ; Wed, 14 Oct 2009 15:31:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 18560-10 for ; Wed, 14 Oct 2009 18:31:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) by mail.postgresql.org (Postfix) with ESMTP id ACA3E63394D for ; Wed, 14 Oct 2009 15:31:36 -0300 (ADT) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1My8dL-0001vB-5t for pgsql-odbc@postgresql.org; Wed, 14 Oct 2009 11:31:35 -0700 Message-ID: <25896531.post@talk.nabble.com> Date: Wed, 14 Oct 2009 11:31:35 -0700 (PDT) From: kishoramballi To: pgsql-odbc@postgresql.org Subject: Postgres inserts null value for parameterized statement MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: kishoramballi@gmail.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.099 tagged_above=-10 required=5 tests=BAYES_00=-2.599, URI_NOVOWEL=0.5 X-Spam-Level: X-Archive-Number: 200910/20 X-Sequence-Number: 10045 Hi, I have created table using following sql statement through psql tool in test database using create table t1(f1 int); table is created. Now I am using an odbc script to insert 5 records. But it inserts 6 records NULL value being the first one inserted. the code snippet is as below. ... ... retVal = SQLDriverConnect(dbHdl, NULL, (SQLCHAR*)"psql", SQL_NTS,outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_NOPROMPT); SQLSetConnectAttr(dbHdl, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); int f1 = 0; ret = SQLPrepare(stmt,(unsigned char*)"INSERT INTO T1 VALUES(?);" , SQL_NTS); ret = SQLBindParameter (stmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,0,0,&f1,0,NULL); int i,count=0; // EXECUTE THE STATEMENT for(i=0;i<5;i++) { f1++; ret = SQLExecute(stmt); ret = SQLTransact(env,dbc,SQL_COMMIT); count++; } ... ... I am using unixodb driver and my odbc.ini file reads as follows. $ vi ~/.odbc.ini [psql] Description = CP resources db Driver = postgres Trace = No TraceFile = sql.log Database = test Servername = localhost UserName = kishoramballi Password = kishoramballi Port = 5432 Protocol = 6.4 ReadOnly = No RowVersioning = No ShowSystemTables = No ShowOidColumn = No FakeOidIndex = No ConnSettings = ExtraSysTablePrefixes = $ vi /etc/odbcinst.ini [ODBC] Trace = yes TraceFile = /tmp/sql.log [postgres] Driver = /usr/lib/libodbcpsql.so Setup = /usr/lib/libodbcpsqlS.so Description = Connector Driver DSN SERVER = localhost Database = test ReadOnly = No [PostgreSQL] Description = PostgreSQL ODBC driver for Linux Driver = /usr/lib/libodbcpsql.so.1 Setup = /usr/lib/libodbcpsqlS.so.1 ExtraSysTablePrefixes = UsageCount = 1 Am I missing something or have I added some thing more than required for this problem to occur. Please help thanks -- View this message in context: http://www.nabble.com/Postgres-inserts-null-value-for-parameterized-statement-tp25896531p25896531.html Sent from the PostgreSQL - odbc mailing list archive at Nabble.com.