[unixODBC-support] unixODBC with FreeTDS on SQL Server

Linda Thompson LHT at DISC.com
Mon Jun 25 23:04:28 BST 2007


I have a legacy application that has always worked with ODBC and MS
SQLServer on Windows as well as Postgres and Oracle.  I'm trying to port
to Linux and use unixODBC with FreeTDS for SQL Server.  My only current
problem is updates and deletes.  I can't seem to get my cursor to change
to SQL_CONCUR_LOCK or allow FOR UPDATE.

My HDBC handle is READ WRITE.
I try to do
    SQLSetStmtOption(CONCURRENCY)=CONCUR_LOCK hstmt=685790 hdbc=6715c0
henv=5928b0 was successful
   Error: hstmt=685790 hdbc=6715c0 henv=5928b0 sql_error=1
   SQL Warning: ReturnCode: 1, Error: 0, State: 01S02:
[unixODBC][FreeTDS][SQL Server]Option value changed

Then when I do a prepare for an positioned update I get an error.
   SQL_CONCURRENCY=READ_ONLY
   SQLSetCursorName() = DAODB00001 was successful
   SQL[SELECT PRODUCT_NO, DESCRIPTION, DIVISION, DEPT, CATEGORY\
>>, MFR, MARGIN, WHOLESALE, COST, ((WHOLESALE*100.0)/COST) FROM PRODUCTS
WHERE\
>> PRODUCT_NO IN (?) FOR UPDATE]
   SQLPrepare (hstmt=685790 hdbc=6715c0)
   ERROR: hstmt=685790 hdbc=6715c0 henv=5928b0 sql_error=-1
   Error=1003, State=37000 Buffer=[unixODBC][FreeTDS][SQL Server]
   Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. 

Is there an option in the DSN that allows this to happen.  I have looked
at many examples, and I can't see that I'm doing anything wrong.  

Thank you!
Linda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20070625/665d0634/attachment.html>


More information about the unixODBC-support mailing list