From: Pascal Viandier <pascal@accovia.com>
To: pgsql-odbc@postgresql.org
Subject: Cannot update or delete rows
Date: Fri, 28 Jul 2006 08:02:17 -0400
Message-ID: <00f401c6b23d$ac4b8f20$270210ac@windows.accovia.com> (raw)
Hi,
I am in the process of modifying existing programs closely bound to Informix to
make them use ODBC with unixODBC on SPARC Sun Solaris.
I setup 3 databases to connect to through ODBC:
- Informix ODBC (CLI)
- MySQL
- PostgreSQL.
I use a test program that makes various ODBC calls (Connect, Select, Insert,
Update, Delete...) on these databases. It works well with the first two but not
with PostgreSQL when it comes to update or delete rows in a table using
SQLSetPos().
I use PostgreSQL 8.1.4 and psqlodbc-08.01.0200.
I have seen many threads on this subject in this newsgroup but I cannot figure
out what to do to make it work.
Using the information related to this problem from this newsgroup I already made
the following changes to my initial setup - with no success - :
- re-created the database with oids since they seem to be essential in this
case.
- put UpdatableCursors=1 in odbc.ini
Here is the odbc.ini part for pgodbc:
[lt]
Driver=/home/pascal/ODBC/libpsqlodbcw.so
Description=PostgreSQL ODBC DRIVER
ServerName=mbench
Database=lt
Port=5432
UserName=postgres
Password=postgres
ReadOnly=0
RowVersioning=1
ShowSystemTables=0
ShowOidColumn=1
FakeOidIndex=0
UpdatableCursors=1
UseDeclareFetch=1
CommLog=1
Debug=1
Trace=Yes
TraceFile=/tmp/pgsql.log
My concern is I cannot change the type of the cursor of the SELECT statement.
When calling SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)
SQL_CURSOR_KEYSET_DRIVEN, 0); - as seen in an other thread - I get the return
code SQL_SUCCESS_WITH_INFO and SQLDiagRec returns:
SQLSTATE:01S02
NATIVE CODE: 16
MESSAGE: Requested value changed.
If I call SQLGetStmtAttr(..., SQL_ATTR_CURSOR_TYPE,...); it returns
SQL_CURSOR_STATIC.
I think this is why I cannot update or delete rows using SQLSetPos() but I do
not understand why I cannot change the cursor type.
I already spent many hours browsing this newsgroup to find a solution but now I
am completely stuck.
Any help would be greatly appreciated.
Thanks in advance.
Pascal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: pascal@accovia.com
Subject: Re: Cannot update or delete rows
In-Reply-To: <00f401c6b23d$ac4b8f20$270210ac@windows.accovia.com>
References: <00f401c6b23d$ac4b8f20$270210ac@windows.accovia.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox