Question

How can I set a JDBC embedded-database to use the Sybase dialect?

Here is what I have:

<jdbc:embedded-database id="dataSource">
   <jdbc:script location="classpath:myscript.sql"/>
</jdbc:embedded-database>
Was it helpful?

Solution

Out of the box, Spring supports H2, Derby, and HSQL embedded databases. If you want to use a different one, you will either have to find someone who has already created support for the one you are looking for, or else you will have to build it on your own.

If you take a look at 13.8.4 of the Spring documentation, they provide the extension points which you could implement to do it yourself (via EmbeddedDatabaseConfigurer or DataSourceFactory). I would also recommend browsing their Jira page to see if anyone is working on implementing support for the embedded database you are after.

OTHER TIPS

Again, dialect is something Hibernate-related. It is defined as a property of LocalSessionFactoryBean:

<bean id="exampleSessionFactory" 
   class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
    <property name="hibernateProperties">
       <props>
         <prop key="hibernate.dialect">org.hibernate.dialect.SybaseDialect</prop>
         ...

But Sybase dialect doesn't mean that the database that it's used against is Sybase. You are free to try to use Sybase dialect with the three embedded databases bundled with Spring @nicholas.hauschild mentioned, but it will most probably fail.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top