I m trying to connect MYSQL 4.1.1 from JSP using java. and I m getting error as described below.

javax.servlet.ServletException: Extra bytes at the end of class file org/gjt/mm/mysql/Driver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.Login100408_jsp._jspService(Login100408_jsp.java:697)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

plz help me I m not getting any solution.

That is a legacy Driver. It is only around for backwords compatability. Use com.jdbc.mysql.Driver instead.

P.S. No need to change your jarfile (depending on the version of course), just change the String in the Class.forName() or Driver.registerDriver() method call.

its working now thanks.

One thing you should also be aware of, database connection from JSP is out of date. Now JSP is used for presentation purposes (user input, or system data presentation for user) and servlet handle logic, which includes DB connectivity

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.