• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not loading database driver

pushpa naga
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Not able to return servlet response as an Json Object.

Much appreciated if anyone help me in this regard.

Here is my exception.

Loading Configuration
java.sql.SQLException: No suitable driver found for oracle:thin:@
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at stockdatabaseAccess.doGet(stockdatabaseAccess.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

William Brogden
Author and all-around good cowpoke
Posts: 13074
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That request never got anywhere near JSON since it could not find a critical driver.

Try to get some simple SQL working in a server first - to be sure everything is configured correctly.

Paul Clapham
Posts: 21443
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a link to the Oracle JDBC FAQ. I haven't used any of Oracle's databases but I think you'll find that your JDBC URL doesn't match the format required by your database.
Bear Bibeault
Author and ninkuma
Posts: 65274
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you really mean to make the username and password to your database public?
Tim Holloway
Saloon Keeper
Posts: 18319
Android Eclipse IDE Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dunno. That closely resembles the URL for the Oracle thin driver, allowing for my rotten memory. There may be a "//" missing, though. Oh. Should be something more like "jdbcracle:thin", too. Best to look it up.

However, you WILL get that "no suitable driver" error if the Oracle driver jar isn't in the right place.

For J(2)EE webapps, the "right place" is in the webapp's main classpath. For Tomcat, that would be the TOMCAT_HOME/lib directory. For other servers, consult the appropriate product documentation.

Although it's not good practice to use DriverManager.getConnection in a J(2)EE webapp. Define and use a connection pool. It's much more efficient use of resources. Enterprise Java is much too expensive to write "quick and dirty" for. That's what PHP is for.

Even if you do use brute-force getConnection(), the Class.forName() method call hasn't been needed for a long time now.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic