Search code examples
sqlhibernatesyntax-errorsap-ase

Sybase ASE 15 + Hibernate: SybSQLException when using quotes in queries


I'm getting syntax error for Hibernate 3.3.2 generated queries containing double-quotes:

create table tbl_version (
    id int identity not null,
    "code_name" varchar(255) null,
    version_nbr varchar(255) null,
    software_name varchar(255) null,
    primary key (id)
)

Caused by: com.sybase.jdbc4.jdbc.SybSQLException: Incorrect syntax near ','.
at com.sybase.jdbc4.tds.Tds.a(Unknown Source)

Anyone knows what's the problem? Since I have the right dialect, I guess Sybase needs some config change.


Solution

  • It's a known issue for the JDBC4 driver: https://issues.jboss.org/browse/JBPAPP-4661

    As a workaround, you can append the following to the JDBC URL: ?SQLINITSTRING=set quoted_identifier on