Setting up a MySQL connection in Openshift

I am new to Openshift and I have one question.

I managed to create the database through "phpMyAdmin", but now I can not connect to it.

The error I get when I try to connect to the database is as follows: javax.servlet.ServletException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Unable to load the JDBC driver class 'com.mysql.jdbc.Driver' javax. faces.webapp.FacesServlet.service (FacesServlet.java:321)

My library libraries are well defined in my Eclipse project. See image below:

enter image description here

Does anyone have any suggestions?

Thanks in advance, Emanuel

+4
source share
3 answers

You are missing the MySQL JDBC driver from your class path.

http://dev.mysql.com/downloads/connector/j/

Download it and add it to your application class path or add a Maven dependency to your build file.

+1
source

Add this to your pom.xml :

 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.24</version> </dependency> 
0
source

I had the same problem and decided to add it by adding a connector to pom.xml .

You have to download it (choose the platform independently) and place it in WEB-INF/lib .

In my case, I had:

 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.27</version> <scope>system</scope> <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/mysql-connector-java-5.1.27-bin.jar</systemPath> </dependency> 
0
source

All Articles