theAlgorithmGod
theAlgorithmGod

Reputation: 1

ClassNotFoundException MySQL OpenShift

Iam trying to connect my app to the MySQL Back on my OpenShift Account via jdbc. Here my source:

Class.forName("com.mysql.jdbc.Driver"); 
        Connection m_connection = DriverManager.getConnection(url , user , pass);

i´ve added my jdbc_connector.jar to the build path, but if im testing it on localhost or in web i always get an
'java.lang.ClassNotFoundException: com.mysql.jdbc.Driver'

How to solve the problem, where to add the jdbc_connector.jar?

Thanks.

Upvotes: 0

Views: 129

Answers (1)

Ya Wang
Ya Wang

Reputation: 1808

JBDC need you to have a path to the jar for the server you are using in path...

Soooo... Do not forget to add the path of the connector to the classpath. If the connector name is mysql-connector-java-5.1.21-bin.jar stored in C:\mysql-connector-java-5.1.21, then add c:\ mysql-connector-java-5.1.21\mysql-connector-java-5.1.21-bin.jar to the classpath.

Oh and here is the connector http://dev.mysql.com/downloads/connector/j/

Upvotes: 2

Related Questions