Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT INTO test_table (text_column) VALUES ('insert')
- 617: A blob data type must be supplied within this context.
- Error: [Informix][Informix ODBC Driver][Informix]
- Illegal attempt to convert Text/Byte blob type.
- [SQLCode: -608], [SQLState: S1000]
- CREATE TABLE _text_test (id serial PRIMARY KEY, txt TEXT)
- # for Jython 2.5 invoke with --verify
- # beacuse of bug: http://bugs.jython.org/issue1127
- import traceback
- import sys
- from com.ziclix.python.sql import zxJDBC
- def test_text(driver, db_url, usr, passwd):
- arr = db_url.split(':', 2)
- dbname = arr[1]
- if dbname == 'odbc':
- dbname = db_url
- print "nn%sn--------------" % (dbname)
- try:
- connection = zxJDBC.connect(db_url, usr, passwd, driver)
- except:
- ex = sys.exc_info()
- s = 'Exception: %s: %sn%s' % (ex[0], ex[1], db_url)
- print s
- return
- Errors = []
- try:
- cursor = connection.cursor()
- cursor.execute("DELETE FROM _text_test")
- try:
- cursor.execute("INSERT INTO _text_test (txt) VALUES (?)", ['prepared', ])
- print "prepared insert ok"
- except:
- ex = sys.exc_info()
- s = 'Exception in prepared insert: %s: %sn%sn' % (ex[0], ex[1], traceback.format_exc())
- Errors.append(s)
- try:
- cursor.execute("INSERT INTO _text_test (txt) VALUES ('normal')")
- print "insert ok"
- except:
- ex = sys.exc_info()
- s = 'Exception in insert: %s: %sn%s' % (ex[0], ex[1], traceback.format_exc())
- Errors.append(s)
- cursor.execute("SELECT id, txt FROM _text_test")
- print "nData:"
- for row in cursor.fetchall():
- print '[%s]t[%s]' % (row[0], row[1])
- if Errors:
- print "nErrors:"
- print "n".join(Errors)
- finally:
- cursor.close()
- connection.commit()
- connection.close()
- #test_varchar(driver, db_url, usr, passwd)
- test_text("sun.jdbc.odbc.JdbcOdbcDriver", 'jdbc:odbc:test_db', 'usr', 'passwd')
- test_text("com.informix.jdbc.IfxDriver", 'jdbc:informix-sqli://169.0.1.225:9088/test_db:informixserver=ol_225;DB_LOCALE=pl_PL.CP1250;CLIENT_LOCALE=pl_PL.CP1250;charSet=CP1250', 'usr', 'passwd')
Add Comment
Please, Sign In to add comment