• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Couldn't Load Database Driver

 
priya sunny
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am trying to connect to Derby Database, the input is given throught the html page , after clicking submit, i get the error message "Couldn't Load Database Driver".
the connection statements i used are here:

Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
connection = DriverManager.getConnection("jdbc:derby:C:\\DerbyDatabases\\MyDB;create=true");

Can anyone help me???
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have the required jar file for derby database on your classpath?
 
priya sunny
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i added the jar and it is working fine now. I am trying to create the table using servlet, first time when i run the application it is getting created. But when i run the "script.sql" it says "Table does not exists". What could be the error?? Is the table getting created somewhere else?? If so how will i find that??
Here is my code for your reference:

String sql ="create table APP.emp1 (userid varchar(10),firstname varchar(10),surname varchar(10),address1 varchar(10),address2 varchar(10),town varchar(10),country varchar(10),zipcode int)";
Statement ps = connection.createStatement();
ps.executeUpdate(sql)
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is there inside your script.sql and are you using the same database where you create this table in script.sql?
 
priya sunny
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In script.sql , i just execute "select * from emp1". It says "Table does not exists"
And i have only one Database in my Derby.
 
priya sunny
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
priya sunny wrote:In script.sql , i just execute "select * from emp1". It says "Table does not exists"
And i have only one Database in my Derby.
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one database is fine, before executing select * from emp1, is the database put in use. I don't know the syntax in derby, in mysql we would use "use <dbname>" and then execute our statements..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic