Mick Morrison
Mick Morrison

Reputation: 105

Configure MySQL connection in Openshift

I am new in Openshift, and I have one question.

I was able to create the database through "phpMyAdmin", but now, I am not able to connect to it.

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

My libraries directories are well defined in my Eclipse Project. See image below:

enter image description here

Does anyone have any suggestion?

Thanks in advance, Emanuel

Upvotes: 4

Views: 3383

Answers (3)

aviggiano
aviggiano

Reputation: 1913

I had the same problem and solved it by adding the connector to my pom.xml.

You have download it (choose platform independent) 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>

Upvotes: 0

user2032663
user2032663

Reputation:

Add this to your pom.xml:

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

Upvotes: 0

maple_shaft
maple_shaft

Reputation: 10463

You are missing the MySQL JDBC driver from your classpath.

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

Either download this and add this to your application classpath or add the Maven dependency to your build file.

Upvotes: 1

Related Questions