473,320 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

odbc errors

hi

i have a piece of code:
....

def connectdb(sql):
import dbi
import odbc
import sys
try:
s = odbc.odbc('DSN=CONN;UID=user;PWD=pass')
cur = s.cursor()
# cur.execute("set nocount on")
cur.execute(sql)
while 1:
rec = cur.fetchone()
if not rec: break
return rec
except:
print 'error while processing ', sys.exc_type,sys.exc_value
s.close()
cur.close()
s = None
cur = None

....
sql = r'update table set col = 'A' where user = "user1"'
connectdb(sql)
when i execute it from CGI, i encounter the following :
error while processing dbi.internal-error [MERANT][ODBC Sybase ASE
driver]Invalid cursor state. in FETCH None

but when i did check the table, the value of col is updated to 'A',
how can i suppress the above error message? or is there some other
things
that are wrong with the code.
thanks

Oct 16 '05 #1
1 2919
ei***********@yahoo.com wrote:
hi

i have a piece of code:
...

def connectdb(sql):
import dbi
import odbc
import sys
try:
s = odbc.odbc('DSN=CONN;UID=user;PWD=pass')
cur = s.cursor()
# cur.execute("set nocount on")
cur.execute(sql)
while 1:
rec = cur.fetchone()
if not rec: break
return rec
except:
print 'error while processing ', sys.exc_type,sys.exc_value
s.close()
cur.close()
s = None
cur = None

...
sql = r'update table set col = 'A' where user = "user1"'
connectdb(sql)
when i execute it from CGI, i encounter the following :
error while processing dbi.internal-error [MERANT][ODBC Sybase ASE
driver]Invalid cursor state. in FETCH None

but when i did check the table, the value of col is updated to 'A',
how can i suppress the above error message? or is there some other
things
that are wrong with the code.
thanks


The update is performed as soon as you execute the cursor.
No recordset is returned from the update, so you can remove
the fetch altogether.

hth
Roger

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Oct 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve | last post by:
I normally use MySQL with PHP, but I'm delving into connecting to Access with ODBC (for a database that I already have set up at work), and I'm running into a couple of errors. I'm just trying to...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
2
by: Lyn Duong | last post by:
hi all, I am trying to create a dts package to transfer data from tables in my sql server 2000 database to a db2 UDB v8.1.4 database. When I use ibm db2 oledb driver for the destination this...
3
by: Jason Gyetko | last post by:
I'm running DB2 v8.1 FP5 and am trying to link tables via ODBC from Access 2002 to my DB2 database. Access lets me connect to the database and returns a list of all tables I can select from, but...
7
by: tina | last post by:
Hello, Can you hale me to define my mistake please? I am trying to run a SQL Pass – Through Query from Access 2000 and inside the record set I am trying to loop for a LoginID. I think that this...
3
by: Detlev Ahlgrimm | last post by:
Hi! I have to use MS-Access2000 as a frontend for an oracle database. And I dont want to see these ORA-xxxx Popups if an error occures. So I use something like the following in access (it should...
14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
4
by: Phil Latio | last post by:
Scenario is: We have an intranet on which a Helpdesk application can be accessed. Data input into the Helpdesk is stored in a Access 2000 database, held on a server. This is great, works fine,...
9
by: Greg Strong | last post by:
Hello All, What is the maximum length of an ODBC pass through query? Things work fine with the code except when I try to create a view which is pretty complex in Oracle. I'm using a DSN...
16
by: network-admin | last post by:
We have Problems with Access query on Oracle 10g Database with ODBC Connection. The Query_1 is such as select * from xtable where ycolumn <"S" Result = ODBC Faild...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.