See http://java.apache.org/faq/index.cgi?file=214


Steve Ruby wrote:

> I'm not sure who to send this too, but I've read much
> documentation and I can't figure out why I can't get a jdbc
> driver or two to work in my servlets
>
> The first few lines of service
> are
>
>     public void service (
>         HttpServletRequest      request,
>         HttpServletResponse     response
>     ) throws ServletException, IOException
>     {
>         PrintWriter             out;
>         String                  title = "Simple Servlet Output";
>
>         String dead = "default";
>
>         try {
>                 Class.forName("org.gjt.mm.mysql.Driver");
>                 Connection con =
> 
>DriverManager.getConnection("jdbc:mysql://db.domain.com:3306/AMR?user=root&password=");
>                 System.out.println("Connected to the db");
>                 dead = "but I'm not dead yet";
>         }
>         catch (ClassNotFoundException e) {
>                 System.out.println("Couldn't find class: " +
> e.getMessage());
>                 dead = "died- ClassNotFoundException";
>
>         }
>         catch (SQLException se){
>                 System.out.println("SQL Exception caught: " + se);
>                 dead = "died- SQLException";
>         }
>
> If I print dead it is always "died-ClassNotFoundException,
> yet if I
> do
> import org.gjt.mm.mysql.Driver
>
> and verbose on compile I get this:
> why won't forName find it?
>
> [loaded
> c:\java\mm.mysql.jdbc-1.2a\mysql.jar(org/gjt/mm/mysql/Driver.class) in 94
> ms]
>
> sorry to send this to this list, it is probably not a jserv problem.
>
> TIA
> Steve
>
> -- --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> READ THE FAQ!!!!     <http://java.apache.org/faq/>
> Archives and Other:  <http://java.apache.org/main/mail.html/>
> Problems?:           [EMAIL PROTECTED]



-- --------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
READ THE FAQ!!!!     <http://java.apache.org/faq/>
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to