0

I wrote java class to connect mysql database and insert data to database on my centos installed pc.(this java file called by asterisk program using AGI). but I got below exception at runtime.

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

How could I solve this ?

1

2 Answers 2

1

Ok. I solved my question. when I run the asterisk program with AGI server, I added mysql connector classpath as below.

java -classpath asterisk-java-0.3.jar:mysql-connector-java-5.1.18-bin.jar:. org.asteriskjava.fastagi.DefaultAgiServer
Sign up to request clarification or add additional context in comments.

1 Comment

This works.. It is not mentioned anywhere in the documentation
0

you need this jar file: mysql-connector-java-{version}.jar

e.g. http://findjar.com/jar/mysql/mysql-connector-java/5.1.9/mysql-connector-java-5.1.9.jar.html

1 Comment

i have added mysql-connector-java-5.1.18-bin.jar and set class path. but still having problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.