473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

JSP database error

when i run this code i got an error .... can any body help me out ?

Expand|Select|Wrap|Line Numbers
  1. <%@page import="java.sql.*"%>
  2. <form action="index.jsp?pg=13" method="post">
  3. <table>
  4. <tr><td>class:</td><td><select name="cl">
  5. <option value="">class</option>
  6. <%
  7. String connectionURL="jdbc:mysql://localhost:3306/intranet?";
  8. Connection cn=null;
  9. Statement st=null;
  10. ResultSet rs=null;
  11. cn = DriverManager.getConnection(connectionURL, "root","");
  12. st = cn.createStatement();
  13. rs = st.executeQuery("SELECT * FROM class");
  14. while(rs.next())
  15. {
  16.     out.print("<option value='"+rs.getString("class")+"'>"+rs.getString("class")+"</option>");
  17. }
  18.  
  19. %>
  20. </select></td></tr>
  21. <tr><td>sub1:</td><td><input type="text" name ="sub1"></td></tr>
  22. <tr><td>sub2:</td><td><input type="text" name ="sub2"></td></tr>
  23. <tr><td>sub3:</td><td><input type="text" name ="sub3"></td></tr>
  24. <tr><td>sub4:</td><td><input type="text" name ="sub4"></td></tr>
  25. <tr><td>sub5:</td><td><input type="text" name ="sub5"></td></tr>
  26. <tr><td>sub6:</td><td><input type="text" name ="sub6"></td></tr>
  27. <tr><td><input type="submit" value="save"/></td></tr></table>
  28. </form>

when running this i got an error message


HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /subjent.jsp:11

8: Connection cn=null;
9: Statement st=null;
10: ResultSet rs=null;
11: cn = DriverManager.getConnection(connectionURL, "root","");
12: st = cn.createStatement();
13: rs = st.executeQuery("SELECT * FROM class");
14: while(rs.next())


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet .java:729)


root cause

javax.servlet.ServletException: No suitable driver found for jdbc:mysql://localhost:3306/intranet?
org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:774)
org.apache.jsp.subjent_jsp._jspService(subjent_jsp .java:77)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet .java:729)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet .java:729)


root cause

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/intranet?
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
org.apache.jsp.subjent_jsp._jspService(subjent_jsp .java:53)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet .java:729)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet .java:729)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.27
Nov 13 '09 #1

✓ answered by Dormilich

@naharol
well, seems like you didn’t use the correct DB driver

3 2819
Dormilich
8,658 Expert Mod 8TB
@naharol
well, seems like you didn’t use the correct DB driver
Nov 13 '09 #2
how to correct my DB driver ..... if it is found incorrect.

Thanking you.
Nov 14 '09 #3
Dormilich
8,658 Expert Mod 8TB
I have no idea but I’d try
Expand|Select|Wrap|Line Numbers
  1. jdbc://localhost:3306/intranet
Nov 14 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: John | last post by:
Hello. If I want to set up my first database and start using it in Dreamweaver what do I need to do? The book I'm working on has a CD with the database on. It is telling me to put it in the...
6
by: Clay Beatty | last post by:
When you create database diagrams in Enterprise Manager, the details for constructing those diagrams is saved into the dtproperties table. This table includes an image field which contains most of...
6
by: Marvin Libson | last post by:
Hi All: I am running DB2 UDB V7.2 with FP11. Platform is Windows 2000. I have created a java UDF and trigger. When I update my database I get the following error: SQL1224N A database...
1
by: pintur | last post by:
The message is: SQL1036C Errore di I/O durante l' accesso al database. SQLSTATE=58030 what is the proble? what for restore tables? thanks
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
0
by: Jonathan Wood | last post by:
I seem to be having errors creating and accessing an SQL database. Unfortunatley, I am brand new to SQL setup and administration issues so this really is not my area of expertise. I know I had...
9
by: Jerim79 | last post by:
I am no PHP programmer. At my current job I made it known that I was no PHP programmer during the interview. Still they have given me a script to write with the understanding that it will take me a...
12
by: Steve | last post by:
I have a database that raises an error when you try to open it and it doesn't open. Trying to open the database with the OpenDatabase method raises the same error. Trying to import any objects...
2
by: Scott Jones | last post by:
Hello, In an attempt to save disk space, I went in and gzipped all of the log files for my database running DB2 version 7.2 . This resulted in the database being marked bad because a log file...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.