Tuesday 15 April 2014

java - Connect to a MySQL DB with JSP through another class -


Can I connect to a MySQL db with JSP through another class?

Here's my own suggestion: ... & Lt;% // JSP / Java Codes UsersDAPInterface users = new UserDAPClass (); // This includes MySQL connections in Java class etc.% & Gt; & Lt; / Body & gt; ...

When I do this, I get a lot of errors and exceptions, in which ClassNotFound , NullPointer etc.

I also found:

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

Which means it It should be that there is no MySQL driver in it. But I have imported the mysql driver, so I do not know that it should usually be imported in any other way. any suggestion?

Ensure that WEB-INF / lib is the folder of your application , As long as there exists, this problem should not come up.

No comments:

Post a Comment