This is my first post on stackoverflow so hopefully I don't sound too incompetent. I'm having an issue connecting my Android App to a PostgresDB that I created. I used the code from this tutorial http://appliedcoffeetechnology.tumblr.com/post/10657124340. Although I modified the String url ... line to the following:
String url = "jdbc:postgresql://192.168.1.101:5556/postgres?user=postgres&password=yeahright";
I followed the other instructions on downloading the JDBC and adding it to the package, I also added the internet permissions line.
I've configured the postgreSQL DB on my Windows 7 machine to allow connections, and even set the incoming connections to "trust" so that the password won't get in the way. I also opened up the 5556 port on the Windows firewall. I can connect to it from my Ubuntu laptop, using the following command: psql 192.168.1.101 -U postgres -p 5556 -d postgres
However, when running the Android App (on a real device) I get "java.sql.SQLException: No suitable driver" thrown by the conn = DriverManager.getConnection(url)
call.
Thank you greatly in advance for your help, and let me know if I can provide any other useful information.
Craig Ringer below mentioned a web service app. Originally I was hesitant as I didn't want to add an even steeper incline to my learning curve, but I decided to go with Django, and it has been amazingly simple.
AFAIK Android doesn't support JDBC natively. (Update: newer versions do). Honestly, you're WAY better off running a web service and having your Android app communicate with the DB via web service requests.
Search SO for "android postgresql".
Some related discussions:
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