Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
| Search | Today's Posts | Mark Forums Read
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 November 2nd, 2003, 05:22 AM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 16 - Driver Not Found - Please Help

Hi everyone,

I was wondering if I could get some help. Everything was going fine in chapter 15 when I used java programs to connect to the database and execute updates and queries. Now, when I try to encapsulate the connectivity into a bean and use the jsp page "booklist.jsp" to connect, an exeception is thrown to the error page which says that my driver is not found. Here is the code segment from Books.java which does the connecting:

package com.wrox.databases;

import java.sql.*;
import java.util.*;

public class Books {

String error = "";
Connection con = null;

public Books() { }

public void connect() throws ClassNotFoundException,
                             SQLException,
                             Exception {
    try {
     Class.forName("com.mysql.jdbc.Driver").newInst ance();
     con = DriverManager.getConnection("jdbc:mysql://localhost/wrox ?user=wil324");
     System.out.println("Database connection established");
    } catch (ClassNotFoundException cnfe) {
     error = "ClassNotFoundException: Could not locate DB driver.";
     throw new ClassNotFoundException(error);
    } catch (SQLException cnfe) {
     error = "SQLException: Could not connect to database.";
     throw new SQLException(error);
    } catch (Exception e) {
     error = "Exception: An unknown error occurred while connecting " +
             "to database.";
     throw new Exception(error);
    }
}
.
.
.

The part where the username and password are needed worked the way it is in the previous programs that I did in Chapter 15. Since a username and password was established for winmysqladmin, I assume that specifying the username and password is not important if I'm running winmysqladmin. Please note that my jsp page that is using the "connect" class in Books.java is actually communicating with it (this is evident because of the error that I get). However, in the environment tab of "winmysqladmin" the text area under myODBC says "Not Found Driver 3.51 not found." Also, I don't think there is a problem with the way my classpath is set because I have connected to the database in previous java programs, but they were more direct (not from a jsp page to a java program). Please help me if you can.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Data source name not found and no default driver s Durkee VB.NET 2002/2003 Basics 0 September 21st, 2007 01:11 PM
No sutitable Driver found....... programmed Java Databases 2 September 4th, 2007 07:18 AM
"Driver not found" e message, el problems cruzer JSP Basics 2 December 19th, 2004 02:13 AM
Data source name not found and no default driver s bjtindle Classic ASP Databases 5 September 10th, 2003 04:35 AM
Ch 16 driver not found dmswdev JSP Basics 1 June 27th, 2003 05:15 AM





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