JDBC Mysql Related Eclipse Error

Asked

Viewed 394 times

-2

I am trying to connect the mysql database from my JAVA application. But I get this message:

org.apache.Jasper.Jasperexception: An Exception occurred Processing JSP page /index.jsp at line 31

28:     String action="";
29:     
30:         String url = "jdbc:mysql://localhost:3606/crudjsp;create=true";
31:         Class.forName("com.mysql.jdbc.Driver"); 
32:         
33:         Connection conn = DriverManager.getConnection(url,"root"," ");
34:         Statement stmt = conn.createStatement();

Picture of the environment: inserir a descrição da imagem aqui

  • Put the whole stacktrace in the question

  • You added the mysql driver to classpath?

  • No! Only in the project. As shown in the image.

  • Take a look if this reply help you.

  • I received this message: HTTP Status 500 - An Exception occurred Processing JSP page /index.jsp at line 33 type Exception report message An Exception occurred Processing JSP page /index.jsp at line 33 Description The server encountered an Internal error that prevented it from fulfilling this request. Exception org.apache.Jasper.Jasperexception: An Exception occurred Processing JSP page /index.jsp at line 33 30: String url = "jdbc:mysql:/localhost/crudjsp"; 31: Class.forName("com.mysql.jdbc.Driver"); 32: 33: Connection Conn = Drivermanager.getConnection(url,"root"," ");

  • If you do not add in the classpath you will not recognize the driver. Right-click the jar and select add to build classpath

  • I’m using the NEON eclipse. You don’t have this option!

  • I also use neon eclipse and have this option yes. Hover over option build path that she appears in the submenu.

  • However, I was able to insert into Classpath

  • HTTP Status 500 - An Exception occurred Processing JSP page /index.jsp at line 33

Show 5 more comments

1 answer

0


I solved the problem by inserting the mysql . jar in the classpath and placing port 3306 in the code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.