简体   繁体   中英

AWS EC2 : Connecting to PostgreSQL from tomcat 7

I have installed tomcat7 and postgreSQL9 on AWS- Ec2 Micro , I am able to connect to the EC2 postgreSQL instance form a spring application running on my local tomcat 7 server.

When I deploy the same war file on the EC2- tomcat7 server, it is throwing the following error..

Cannot create JDBC driver of class '' for connect URL 'jdbc:postgresql://ec2-user@x-x-x-x-x.us-x-x.compute.amazonaws.com/test'
java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(DriverManager.java:279)

I have copied postgresql-9.1-901.jdbc3.jar to /usr/share/tomcat7/lib

I have tried using the AWS internal IP ... No luck..

I don't know what I am doing wrong. The same war with same configuration works from local tomcat7. Am I missing any thing with AWS tomcat7 configuration?

Hi it seems you haven't included the postgresql jdbc jar. Try including that it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM