The documentation recommends that the driver be loaded:
sql::MySqlDialect.driver=com.mysql.jdbc.Driver
However, the MySqlDialect, GenericDialect do not have the "driver" slot any longer.
I used Class.forName to load the driver (org.h2.Driver). Is there another way without FFI?
go4Sun 7 Nov 2010
sql::MySqlDialect.driver is a config key in etc/sql/config.props. I also think it is better as a slot.
Why not make a H2Dialect by yourself?
brianSun 7 Nov 2010
The way JDBC works is pretty annoying, but what we've tried to do keep things simple is to force the classload by dialect in your etc/sql/config.props. From sql-doc
Ensure the JDBC class is loaded into memory. The simplest way to preload the class is to define a config prop in "etc/sql/config.props" for your dialect:
sql::MySqlDialect.driver=com.mysql.jdbc.Driver
florinSun 7 Nov 2010
Created an H2Dialect and it works for me as specified above. Using config.props was surprising for this purpose and it feels more like a framework approach though.
brianSun 7 Nov 2010
I guess if a given Dialect's JDBC driver always used the same driver class, then it would be convenient to try a Java classloader in the static initializer of the dialect. Note sure that would work for all cases though.
florin Sat 6 Nov 2010
The documentation recommends that the driver be loaded:
sql::MySqlDialect.driver=com.mysql.jdbc.Driver
However, the MySqlDialect, GenericDialect do not have the "driver" slot any longer.
I used Class.forName to load the driver (org.h2.Driver). Is there another way without FFI?
go4 Sun 7 Nov 2010
sql::MySqlDialect.driver
is a config key inetc/sql/config.props
. I also think it is better as a slot.Why not make a
H2Dialect
by yourself?brian Sun 7 Nov 2010
The way JDBC works is pretty annoying, but what we've tried to do keep things simple is to force the classload by dialect in your etc/sql/config.props. From sql-doc
Ensure the JDBC class is loaded into memory. The simplest way to preload the class is to define a config prop in "etc/sql/config.props" for your dialect:
florin Sun 7 Nov 2010
Created an H2Dialect and it works for me as specified above. Using config.props was surprising for this purpose and it feels more like a framework approach though.
brian Sun 7 Nov 2010
I guess if a given Dialect's JDBC driver always used the same driver class, then it would be convenient to try a Java classloader in the static initializer of the dialect. Note sure that would work for all cases though.