Thanks! That worked. This is strange:
Class.forName(dbDriver).newInstance();
compiles fine, with my JSP and JavaBean classes, but I
have to use:
Class.forName(dbDriver);
in order for this Servlet to compile.
Thanks again, Panos.
--- Panos Skondras <[EMAIL PROTECTED]> wrote:
> Leave out the .newInstance()..
> E.g
> Class.forName("oracle.jdbc.driver.OracleDriver");
> Connection con =
> DriverManager.getConnection("URL");
>
> "Z.BEAT" wrote:
>
> > Here is a code excerpt:
> > ---------------------------
> > String dbDriver = "org.gjt.mm.mysql.Driver";
> >
> > try
> > {
> > Class.forName(dbDriver).newInstance()
> > }
> > catch(ClassNotFoundException cnf)
> > {
> > out.println(cnf);
> > }
> > -----------------------------
> > When I go to compile this servlet, I have been
> getting
> > boeither one of th of the following exceptions:
> >
> > "Undeclared exception. IllegalAccessException"
> > AND
> > "Undeclared exception. InstantiationException"
> >
> > Any ideas? I have never had trouble using the
> mysql
> > driver. Itis working fine on my other JavaBeans,
> JSPs
> > and Serlets. And I always use the same database
> > algorithms, so I don't think I am doing anything
> > different. The only possible change that I can
> see is
> > that these are the first servlets, whereas I have
> > previously been coding with JavaBeans. The Java
> API
> > documentation mentions that these errors may be
> thrown
> > if the constructor is not present, or accessible
> for
> > the class (Class.forname.newInstance()). I have
> not
> > touched the driver since I installed it, so I am
> > inclinec to think it has something to do with the
> > servlet environment.
> >
> > Thanks! Sorry for the long-wind!
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Y! Web Hosting - Let the expert host your web site
> > http://webhosting.yahoo.com/
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:tomcat-user-help@;jakarta.apache.org>
>
> > --
> To unsubscribe, e-mail:
> <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:tomcat-user-help@;jakarta.apache.org>
__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/
--
To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>