Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 22nd, 2005, 11:38 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aadz5
Default Connection String

Hiya Guys,

I am new to all this JSP stuff. I am trying to connect to a MySQL database. I get this exception: -

org.apache.jasper.JasperException: com.mysql.jdbc.Driver

I have downloaded the driver and stored it in the C:\Tomcat\common\lib directory. But I still get this error. Here is my code: -

<%@ page import="java.sql.*" %>
<%
String connectionURL = "jdbc:mysql://localhost:3306/adnan?user=Root;password=password";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
%>

<html><body>

<%
Class.forName("com.mysql.jdbc.Driver").newInstance ();
connection = DriverManager.getConnection(connectionURL, "", "");
statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM pet");

while (rs.next()) {
out.println(rs.getString("owner")+"<br>");
}



rs.close();
%>

</body></html>

Thanks Guys.

Adz - The World is not enough
__________________
Adz - Learning The J2EE Ways.
 
Old January 24th, 2005, 04:36 AM
Authorized User
 
Join Date: Feb 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to cash
Default

the name of jdbc driver is realy com.mysql.jdbc.driver?please check






Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection string MunishBhatia ASP.NET 2.0 Professional 4 May 16th, 2007 05:50 AM
Connection String jmss66 Oracle 4 August 8th, 2006 03:19 AM
Connection String slgknjn VB Databases Basics 2 February 26th, 2005 03:14 AM
Connection String fs22 Classic ASP Databases 3 August 30th, 2004 01:25 AM
Connection String Help. diamond2165 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 7th, 2003 06:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.