Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Couldn't Load Database Driver

 
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???
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • 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 Spring Java
  • 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 Spring Java
  • 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..
 
Hang a left on main. Then read this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic