I am running into a problem with a simple database row insert into
Sybase.
I could see others running into the same problem since we use the same
jconn3 driver.
I am using iBatis 2.3.4.726 (the last version of iBatis 2), Sybase
Thin jconn3 version 6.5 drivers, and JUnit 4 on Java 1.6.
The problem is that you can't insert into a table if there are more
than 2 text/varchar columns defined in the table.
For instance if you have a table like this:
CREATE TABLE section(
id INTEGER IDENTITY PRIMARY KEY,
name text,
summary text,
description text
)
And you try the configuration above, you receive the following error:
com.sybase.jdbc3.jdbc.SybSQLException: A wrong datastream has been
sent to the server. The server was expecting token 32 but got the
token 33. This is an internal error.
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
at
com.sybase.jdbc3.tds.Tds.new(Unknown Source)
at com.sybase.jdbc3.tds.Tds.doCommand(Unknown Source)
at com.sybase.jdbc3.tds.Tds.endTransaction(Unknown Source)
at com.sybase.jdbc3.jdbc.SybConnection.rollback(Unknown Source)
...
at com.ibatis.common.jdbc.SimpleDataSource
$SimplePooledConnection.invoke(SimpleDataSource.java:958)
...
at
com.ibatis.common.jdbc.logging.ConnectionLogProxy.invoke(ConnectionLogProxy.java:
68)
...
at
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.rollback(JdbcTransaction.java:
72)
at
com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:
87)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:
734)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:
176)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:
153)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:
835)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:
410)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:
82)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:
58)
at com.xxxxxxxxxxx.dao.SectionDAO.createSection(SectionDAO.java:75)
at com.xxxxxxxxxxx.model.SectionTest.testContext(SectionTest.java:34)
...
at
org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:
160)
Now change the table definition to leave out the description field to
this:
CREATE TABLE section(
id INTEGER IDENTITY PRIMARY KEY,
name text,
summary text
)
Then the table insert happens.
There is not much on Google for the "The server was expecting token 32
but got the token 33" exception.
http://www.talendforge.org/bugs/view.php?id=13087&nbn=2
http://comments.gmane.org/gmane.comp.java.ibatisdb.user/39
This post (updated today) in particular uses the jconn3 driver with
Hibernate/Spring/JBoss:
http://community.jboss.org/message/557138
It mentions switching to jTDS driver for Sybase which is not an option
for me.
I see a bug was opened up on it on the old iBatis' Apache Support
site:
http://osdir.com/ml/db.ibatis.devel/2006-04/msg00036.html
But the bug was closed prematurely by Larry Meadors with iBatis
because they moved to Google Groups myBatis.