0

I have looked at all the previous questions of this type and followed the instructions to no avail, so please do not mark this as duplicate. I was hoping someone would look at my case and give me some tips. I am using Android studio. I downloaded the postgres driver from [https://jdbc.postgresql.org/download.html][1]. Here are my questions.

Where do I put the driver in my project files? Right now, it is just sitting in my downloads folder. I have undone everything I experimented with that previous threads told me to try(adding modules, creating a dependency, classpath, etc.)

Do I need to change the name of the jar file?

How does the "org.postgresql.Driver" connect to this jar file?

I also know JDBC is not the best way for android to connect to a postgres DB but this is my first app so I'm just taking this as a learning experience.

  • You need to put the driver on the classpath of your application. Note that JDBC drivers are for Java, and might not always work under Android (in general you should access databases directly from Android, use a REST service to mediate). – Mark Rotteveel Jul 18 '16 at 19:02
  • That should have read: "in general you should **not** access databases directly from Android, ..." – Mark Rotteveel Jul 19 '16 at 06:50
  • Ensure that the jar is on your classpath. Then, you'll be able to use JDBC or whatever other library you wish to access your Postgresql database. It's as simple as that. And this is a dupe for sure. – ManoDestra Jul 19 '16 at 13:47
  • Possible duplicate of [java.lang.ClassNotFoundException: org.postgresql.Driver, Android](http://stackoverflow.com/questions/10903481/java-lang-classnotfoundexception-org-postgresql-driver-android) – ManoDestra Jul 19 '16 at 13:48

0 Answers0