File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Derby java.sql.SQLException: No suitable driver found for URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Derby java.sql.SQLException: No suitable driver found for URL" Watch "Derby java.sql.SQLException: No suitable driver found for URL" New topic
Author

Derby java.sql.SQLException: No suitable driver found for URL

oz erudio
Greenhorn

Joined: Mar 09, 2012
Posts: 4
My code is below:




I use the three conventions but it gives the same exception I enclosed below.. WHYY?



java.sql.SQLException: No suitable driver found for URL
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.example.ch3.iteration2.Database.lookupFullname(Database.java:32)
at org.example.ch3.iteration2.HelloServlet.doGet(HelloServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

Did you perhaps forget to load that class?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
oz erudio
Greenhorn

Joined: Mar 09, 2012
Posts: 4
No, I forgot to disconnect from the database before running the application. Derby does not allow to be shared by multiple processes..
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

The error message would seem to indicate differently. Right now the driver appears to just say that it's not valid at all for the connection String, so DriverManager skips it completely. If I'd have written that driver I would have chosen a different error message and throw an SQLException from the driver itself.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Derby java.sql.SQLException: No suitable driver found for URL
 
Similar Threads
Doubt on Servlet having database connection?
Tomcat and jdbc/odbc
Problem in connecting MySql with Servlets
SQL Exception No suitable driver
help Required in compiling a Jsp page