How to connect to a PostgreSQL server via JDBC in Android? How to connect to a PostgreSQL server via JDBC in Android? postgresql postgresql

How to connect to a PostgreSQL server via JDBC in Android?


You can find people talking about deploying the JDBC driver to talk to PostgreSQL on the pgandroid mailing list. Some examples there and if you run into problems that's the right place to ask for help. I believe the regular .jar files work fine with recent Android versions, but you may have to patch things to add compatibility with older Android versions.

The other option if you don't want to use Java/JDBC is to use the psqldroid library.


If a direct connection between mobile devices and the database server is really what you want (no security concerns) then you wouldn't need any additional library? Just deploy the JDBC driver on android, I guess...?

An other option would be to create a mini web server in front of the PosgreSQL server, containing the JDBC driver. Then you could define a simple protocol of sending/receiving SQL/resultsets via HTTP. The advantage of this is, your application footprint on the mobile device is smaller.