I have to connect to a PostgreSQL server in LAN without web service. At the moment I think JDBC is the only way I can consider of.
How can I fulfill this? Is there any ready-to-use 3rd party library I can import to my Android project?
Any reply would be appreciated.
Install and configure PostgreSQL on Termux Once you have successfully installed this set of scripts, you can use your Android tablet or smartphone as a PostgreSQL clone database server.
JDBC APIs make use of JDBC drivers to get access to databases like PostgreSQL. JDBC APIs other than accessing the tabular data, also enable you to perform operations on the databases. You can perform save, update, delete, and fetch operations on the data stored in any database using JDBC.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With