• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting Up the Derby DB  RSS feed

 
Florian Jedamzik
Ranch Hand
Posts: 46
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi;)

I'm new to JDBC and as I am trying to check out setting up the Derby-Db
from Chapter 10, I always encounter the Errors described on Selikoff.net/ocp...

But I did everything as described there (I have a Windows machine).

This is my Code (the same as on the WebSite of Mr. Selikoff):



I set the Classpath like this:

C:\Program Files\Java\jdk1.8.0_121\db\lib (or is it: C:\Program Files\Java\jdk1.8.0_121\db\lib\derby.jar   ?)

But I still encounter the following Error when running
the SetupDerbyDatabase Example in Eclipse:



I really don't know what to do now...;)

I hope someone does know;)

Kind regards
Florian
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to set up the classpath so that it includes a reference to the Derby JDBC jar file. Asking what the correct path to the jar file is, that's fruitless because we don't know where you put it. You do have the jar file, don't you? If you don't then you'll have to get it. I haven't read the book you're referring to so I don't know what it told you about acquiring a copy of the jar file.
 
Florian Jedamzik
Ranch Hand
Posts: 46
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Paul,

yes I do have it;)

Mybe I was a little inexact here..
To be more specific:

My derby.jar File is here in this Folder:


C:\Program Files\Java\jdk1.8.0_121\db\lib


The Class I want to work with (SetupDerbyDatabase) is here:


C:\Users\FloJe\git\ocp_certification\OCPJP2\Chapter110 - JDBC\com\ocp\Chapter110\DBSetUp\SetupDerbyDatabase.java


Setting the CP from the command prompt

java -cp "C:\Program Files\Java\jdk1.8.0_121\db\lib\derby.JAR;." SetupDataBase

does always give me this:

"Could not find or load main class derby.SetupDerbyDatabase"


As you can see, I have the current Directory (dot) in my ClassPath and the correct separator (semicolon for Windows).

Maybe I am overlooking something...but I don't know what...

Kind regards & Thank you very much;)

Florian

 
Florian Jedamzik
Ranch Hand
Posts: 46
3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found the solution! ))

Had to add derbyclient.jar and derby.jar to the Library in my Java Build Path!;)

I don't know why, but it worked and printed 5!

Yeah!
Have a nice day all!;))))
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36441
454
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good job on figuring it out!
 
Florian Jedamzik
Ranch Hand
Posts: 46
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Jeanne!;)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!