[DB-SIG] DataError: ('22005', 0, '[Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification', 4579)

Khawaja-Shahzad Butt kshahzadbutt at gmail.com
Mon Oct 18 16:28:32 CEST 2004


Hello all,
              my code looks like this:
db = mx.ODBC.Windows.DriverConnect('DSN=zoe;UID=test;PWD=temp')
c = db.cursor()
dq= "delete from rss_feed_items"
c.execute(dq)
feed_item_feeddescription_utf8=feed_item_feeddescription.encode('utf8');
feed_item_title=feed_item_title.encode('utf8');
feed_item_link=feed_item_link.encode('utf8');
item_author=item_author.encode('utf8');
item_dmodified=item_dmodified.encode('utf8');

q="""INSERT INTO rss_feed_items(
   item_date,
   item_title,
   item_author,
   item_permalink,             
   item_description)
    VALUES(
     ?, ?, ?, ?, ?)"""
. c.execute(q,(item_dmodified,feed_item_title,item_author,feed_item_link,feed_item_feeddescription_utf8),)
db.commit()
 c.close()
 db.close()

I get this error:
Traceback (most recent call last):
  File "C:\Python23\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\feedparser-3.3\feedparser\test.py", line 573, in ?
  File "C:\feedparser-3.3\feedparser\test.py", line 41, in info_extract
    rss_20extraction(result,url)
  File "C:\feedparser-3.3\feedparser\test.py", line 312, in rss_20extraction
    dbinsertfeeditem(feed_item_title,feed_item_link,item_author,feed_item_feeddescription,item_dmodified)
  File "C:\feedparser-3.3\feedparser\test.py", line 432, in dbinsertfeeditem
    ##    c.execute("insert into rss_feed_items
(item_date,item_title,item_author,item_permalink,item_description)\
DataError: ('22005', 0, '[Microsoft][ODBC SQL Server Driver]Invalid
character value for cast specification', 4579)

I am using connection to SQL servers as system DSN. python win and mxODBC.
I am unable to figure what's the problem.
Please reply
Thank you


More information about the DB-SIG mailing list