How to use a JDBC driver different than the default SQLDroid driver with JDXA ORM?

Here are the steps to use a new non-default JDBC driver with JDXA ORM:

1- Define a class, say MyDatabaseAndJDX_Initializer, that extends the class com.softwaretree.jdxandroid.DatabaseAndJDX_Initializer

2- Override the following two methods in the class MyDatabaseAndJDX_Initializer to provide the new JDBC driver specific values:
/** * Returns the the fully expanded class name of the JDBC driver to be used by JDX ORM. * A subclass may override this method to provide a non-default JDBC driver name. * <p> * @return JDBC Driver class name */ protected String getJDBCDriverClass() { return "org.sqldroid.SQLDroidDriver"; } /** * Returns the prefix for the JDBC url as per the JDBC driver used. * A subclass may override this method to provide a non-default value. * * @return JDBC url prefix */ protected String getJDBCPrefix() { return "jdbc:sqldroid:"; }
3- In the method AppSpecificJDXSetup.initialize() of you app, add the following statement (see the sample project JDXAndroidListExample1 for an example):
setDatabaseAndJDX_InitializerClass(ormId, MyDatabaseAndJDX_Initializer.class);

4- Add the new JDBC driver code (e.g., its jar file as a library) in your project


  • Same steps can be followed for any other similar driver or these are specific to JDBC driver?
  • Good question. JDXA uses a JDBC driver to interface with a SQLite database. So the above steps are meant for a JDBC driver.
Sign In or Register to comment.