How to connect HSQL (file based) with my android app?

拥有回忆 提交于 2019-12-11 03:23:46

问题


Hello I have a problem connecting my android app to HSQLDB.

First question:

Is there a specific android jar for HSQLDB that i should use or could I use any HSQL jar?

Second question:

If I can use the provided jar. How can I get the connection to work and what should I place in the Class.forName("") as I was getting a ClassNotFoundException error when using: Class.forName("org.hsqldb.jdbc.JDBCDriver") or Class.forName("org.hsqldb.jdbc.JDBCDriver").newInstance() ?

Thank you.


回答1:


I have been able to establish a connection to an HSqlDB in Android 4.1.

Anyone who's looking to do this in Eclipse, make sure you have the hsqldb.jar in your libraries and make sure it's exported. All of this is in the Project > Java Build Path in Eclipse.

I'm able to make a connection and it has created a new set of database files. I'm using a file based db. Specifically I'm building a LibGDX game for Ouya, but it should work for any android project. The code that runs Hsql is in a completely different project from the Android project, so I needed to have it as a library for both, and to have it exported from the Android project.



来源:https://stackoverflow.com/questions/11010178/how-to-connect-hsql-file-based-with-my-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!