How to connect eclipse to postgresql?

34,841

Solution 1

I am providing certain link which might help you to connect postgres with eclipse

http://omgnoes.wordpress.com/2011/04/12/postgres-jdbc-connection-in-eclipse/

http://wiki.postgresql.org/wiki/Working_with_Eclipse

http://www.mkyong.com/jdbc/how-do-connect-to-postgresql-with-jdbc-driver-java/

Solution 2

Assuming you're starting Tomcat from Eclipse (for debugging) and you're getting ClassNotFoundException (you haven't provided any info, so I'm assuming the most probable error).

You have JRE, but you need also PostgreSQL JDBC driver. This is separate jar with name similar to that: http://mvnrepository.com/artifact/postgresql/postgresql/9.1-901.jdbc3. You must have that jar either in your WAR archive or in Tomcat shared library directory.

Under Eclipse, there's also the possibility to add in manually to run class path, but I recommend you to pack this jar into war, because you'll have to run this on 'normal' Tomcat anyway.

Share:
34,841
apol3pain
Author by

apol3pain

Updated on November 16, 2020

Comments

  • apol3pain
    apol3pain over 3 years

    How can I connect eclipse with postgresql?

    I have a server which is tomcat v6.0 but I can't connect with postgresql.

    Please help me, If you have a sample code I just need it thanks.