on 2012 Nov 08 6:28 AM
Hi,
I have a sybase IQ database running and am using JPA / Hibernate with C3P0 for connection pooling with a Jconnect JDBC Driver and am having problems storing data in a 'Timestamp' column.
My table is as follows:
CREATE TABLE my_employee ( employee_id int not null default autoincrement, name varchar(50), dob timestamp, CONSTRAINT pk_myemp2 PRIMARY KEY (employee_id ) )
My entity is as follows:
@Entity @Table(name = "my_employee") public class EmployeeEntity { @Id @Column(name="employee_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(name="name") private String name; @Temporal(TemporalType.TIMESTAMP) @Column(name="dob") private Date dateOfBirth; }
The error I get is as follows:
11:02:32.700 [main] DEBUG org.hibernate.util.JDBCExceptionReporter - could not insert: [com.camelot.ctp.il.EmployeeEntity] [insert into dba.my_employee (dob, name) values (?, ?)] com.sybase.jdbc3.jdbc.SybSQLException: SQL Anywhere Error -1006001: IQ Internal error. Please report this to Sybase IQ support. Unexpected data type number: 28 -- (hos_dt.cxx 619) at com.sybase.jdbc3.tds.Tds.a(Unknown Source) ~[sybase-driver-12.jar:na] at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source) ~[sybase-driver-12.jar:na] at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source) ~[sybase-driver-12.jar:na] at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) ~[sybase-driver-12.jar:na] at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) ~[sybase-driver-12.jar:na] at com.sybase.jdbc3.jdbc.SybStatement.updateLoop(Unknown Source) ~[sybase-driver-12.jar:na] at com.sybase.jdbc3.jdbc.SybStatement.executeUpdate(Unknown Source) ~[sybase-driver-12.jar:na] at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeUpdate(Unknown Source) ~[sybase-driver-12.jar:na] at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate(P6LogPreparedStatement.java:183) ~[p6spy-1.jar:na] at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105) ~[c3p0-0.9.1.2.jar:0.9.1.2] at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate(P6LogPreparedStatement.java:183) ~[p6spy-1.jar:na] at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:93) ~[hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:56) ~[hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2346) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2853) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:320) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:129) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:69) [hibernate-entitymanager-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:201) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:147) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:71) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:808) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:782) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:786) [hibernate-core-3.6.10.Final.jar:3.6.10.Final] at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:839) [hibernate-entitymanager-3.6.10.Final.jar:3.6.10.Final] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_32] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_32] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_32] at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_32] at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240) [spring-orm-3.0.3.RELEASE.jar:3.0.3.RELEASE] at $Proxy21.persist(Unknown Source) [na:na] at com.camelot.ctp.il.EmployeeDao.persist(EmployeeDao.java:19) [classes/:na] at com.camelot.ctp.il.EmployeeDaoTest.testPersist(EmployeeDaoTest.java:32) [test-classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_32] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_32] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_32] at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_32] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) [junit-4.10.jar:na] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.10.jar:na] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) [junit-4.10.jar:na] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit-4.10.jar:na] at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) [spring-test-3.0.3.RELEASE.jar:3.0.3.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) [spring-test-3.0.3.RELEASE.jar:3.0.3.RELEASE] at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) [spring-test-3.0.3.RELEASE.jar:3.0.3.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240) [spring-test-3.0.3.RELEASE.jar:3.0.3.RELEASE] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) [junit-4.10.jar:na] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [junit-4.10.jar:na] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [junit-4.10.jar:na] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [junit-4.10.jar:na] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [junit-4.10.jar:na] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [junit-4.10.jar:na] at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-3.0.3.RELEASE.jar:3.0.3.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-3.0.3.RELEASE.jar:3.0.3.RELEASE] at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [junit-4.10.jar:na] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180) [spring-test-3.0.3.RELEASE.jar:3.0.3.RELEASE] at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) [surefire-junit4-2.4.3.jar:2.4.3] at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) [surefire-api-2.4.3.jar:2.4.3] at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) [surefire-api-2.4.3.jar:2.4.3] at org.apache.maven.surefire.Surefire.run(Surefire.java:177) [surefire-api-2.4.3.jar:2.4.3] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_32] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_32] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_32] at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_32] at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) [surefire-booter-2.4.3.jar:2.4.3] at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) [surefire-booter-2.4.3.jar:2.4.3]
I have used P6SPY to intercept the SQL getting to the driver and it seems valid:
insert into dba.my_employee (dob, name) values ('2012-11-08 11:02:32.644', 'James')
The best I can do is change the TemporalType on the @Temporal annotation to TemporalType.DATE which results in a date without time being inserted successfully into the db.
I am using JConnect3, driverClass com.sybase.jdbc3.jdbc.SybDriver, jdbcUrl jdbc:sybase:Tds:localhost:2638/iqdemo
Please let me know if you need any more details.
Request clarification before answering.
com.sybase.jdbc3.jdbc.SybSQLException: SQL Anywhere Error -1006001: IQ Internal error. Please report this to Sybase IQ support. Unexpected data type number: 28
This is an issue with how IQ is interpreting the jConnect type data being described by the driver - it doesn't recognize it as a valid data type. The data type is interpreted by the engine, so this is likely an issue with IQ engine itself. Have you reported this issue to IQ technical support or on the IQ newsgroup?
I am using JConnect3
This is incorrect - I do believe you're using JDBC3 / jconn3.jar, which would imply you're using jConnect 6.0 or 6.05.
What version/build is reported if you run java -jar jconn3.jar
against the jConnect driver? You'll need this information if you're opening up a technical support case with the IQ support team.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
29 | |
9 | |
8 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.