This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes derby problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "derby problem" Watch "derby problem" New topic
Author

derby problem

Suleman zia
Ranch Hand

Joined: Apr 19, 2007
Posts: 70
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


SCJP 1.5
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

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");


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Suleman zia
Ranch Hand

Joined: Apr 19, 2007
Posts: 70
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

Joined: Apr 19, 2007
Posts: 70
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
 
Consider Paul's rocket mass heater.
 
subject: derby problem
 
Similar Threads
response.sendRedirect not working
Enumeration
Killing session when closing the browser
java.util.Enumeration
A href command not working