Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JSP Interest »

Re: JDBC no suitable driver

Mikil

2003-12-01

Replies:

Thank you to all of you for the prompt reply and apologies for the belated
response from me.

I just started from fresh i.e. re-intsalled redhat 9 OS and all other
relevant tools. I still get the same error.

Below are the codes that I am using to connect to the mysql db through JSP.


<html>
<head>
<title>Database Access</title>
</head>
<%@(protected).*" %>
<body>

<%

Class.forName("com.mysql.jdbc.Driver").newInstance();

// java.sql.Connection conn;

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:8080/test?user=blah&pass
word=blah");

Statement stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
java.sql.ResultSet.CONCUR_READ_ONLY);

ResultSet rs = stmt.executeQuery("SELECT * FROM User_Login");

// ResultSet rs = stmt.setFetchSize(Integer.MIN_VALUE);

while (rs.next())
{
String userID = rs.getString("user_id");
String userName = rs.getString("user_name");
String userPassword = rs.getString("user_pwd");

out.print("<tr>");
out.print("<td>" + userID + "</td>");
out.print("<td>" + userName + "</td>");
out.print("<td>" + userPassword + "</td>");
}

conn.close();
%>
</table>
</body>
</html>

Hope this helps to you to help him.

Rgds & thanks

Mikil

----- Original Message -----
From: "Paul Copeland" <tech@(protected)>
To: <JSP-INTEREST@(protected)>
Sent: Saturday, November 29, 2003 4:39 AM
Subject: Re: JDBC no suitable driver


> Have you tried connecting to the DB outside the servlet environment to
> see if you can can get a JDBC connection? Try putting that into a 10
> line Java program to confirm that you are loading the driver classes
> correctly (and send us that code if it still doesn't work). After that
> you can work on integration with the Servlet container.
>
> Paul Copeland
> JOT Servlets - A Framework for Servlet Applications
> http://www.jotobjects.com
>
>
> > Date:   Wed, 26 Nov 2003 17:01:15 +0800
> > From:   Mikil <mikil@(protected)>
> > Subject: Re: [Shameless Plug] Servlets and JavaServer Pages; the J2EE
Web Tier
> >
> > Hi to everyone who comes across this mail.
> >
> > I am trying to implement a web application using jsp and sevrlet on os =
> > linux redhat 9, java ver 1.4.2_05, apache tomcat server ver 4.1.27, =
> > mysql ver 3.23.54 std and mysql_connector_java_3.0.9stable.=20
> >
> > I am able to execute jsp and servlets, but get an error while I try to =
> > access the DB. The error says "no suitable driver". But I checked all =
> > documents related to this matter, according to which it is correct.=20
> >
> > Will be glad and thankful if someone is able to resolve this.
> >
> > Thanks.
> >
> > Mikil
>
>
===========================================================================
> To unsubscribe: mailto listserv@(protected)
JSP-INTEREST".
> For digest: mailto listserv@(protected)
DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
> http://java.sun.com/products/jsp
> http://archives.java.sun.com/jsp-interest.html
> http://forums.java.sun.com
> http://www.jspinsider.com
>

===========================================================================
To unsubscribe: mailto listserv@(protected)".
For digest: mailto listserv@(protected)".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com
©2008 junlu.com - Jax Systems, LLC, U.S.A.