• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

derby problem

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I am using JBuilder 2007. i am running the builtin derby database. i made a servlet and tried to connect it with my database but for some reason it throws an SQL exception that

Error.java.sql.SQLException: No suitable driver

here is my code.


and here is my database code


Thanks for the help
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

The JDBC/ODBC bridge driver is the wrong driver for Derby. Try this:

Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
 
Suleman zia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok i got it.


EVerything works fine. so now when i run my servlet through tomcat5.0 and try to enter the fields firstname, lastname, username, password and click on button submit it gives me an error stating table USERS does not exist. How? Why? when i can see my table USERS in the database explorer. any ideas?
 
Suleman zia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dont ask me how but i changed my table to USERS.posts and it worked lol looks like in derby whenever you would like to create a table you need to add .posts.

Thankyou rancer always helpful :--)

Hope to bug you for my next task
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic