I have a java app that used to use a property and I am not sure with the changes I've
made to the class path how to find the driver.
I thought I was using the exact same installation but I can't find the driver.
Can someone please tell my what my new property "derbyDriver" should be based on all the
Enviornment variables that I set.

I used this property for months and months etc. and it worked before but now I had to reset \
everything. Hopefully this will enable ij for derby.


my property

<entry key="derbyDriver">org.apache.derby.jdbc.EmbeddedDriver</entry>

the unzipped dir of apache derby location
C:\db-derby-10.6.2.1-bin


break down of the variables I set RIGHT CLICK ON PROPERTIES OF C:\

DERBY_INSTALL=C:\db-derby-10.6.2.1-bin


JAVA_HOME C:\Program Files\Java\jdk1.6.0_21

PATH C:\Program Files\Java\jdk1.6.0_13\bin;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\db-derby-10.6.2.1-bin

CLASSPATH C:\db-derby-10.6.2.1-bin\lib\derby.jar;C:\db-derby-10.6.2.1-bin\lib\derbytools.jar

set embeddedCP.bat

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\Steve>cd C:\db-derby-10.6.2.1-bin

C:\db-derby-10.6.2.1-bin>cd bin

C:\db-derby-10.6.2.1-bin\bin>setEmbeddedCP.bat

C:\db-derby-10.6.2.1-bin\bin>SET DERBY_HOME=C:\DB-DER~1.1-B

C:\db-derby-10.6.2.1-bin\bin>set CLASSPATH=C:\DB-DER~1.1-B\lib\derby.jar;C:\DB-D
ER~1.1-B\lib\derbytools.jar;C:\db-derby-10.6.2.1-bin\lib\derby.jar;C:\db-derby-1
0.6.2.1-bin\lib\derbytools.jar

C:\db-derby-10.6.2.1-bin\bin>

my property

<entry key="derbyDriver">org.apache.derby.jdbc.EmbeddedDriver</entry>

error

run:
java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at model.dao.ConnectDerbyDAO.loadDatabaseDriver(ConnectDerbyDAO.java:174)
        at model.dao.ConnectDerbyDAO.<init>(ConnectDerbyDAO.java:116)
        at model.dao.ConnectDerbyDAO.<init>(ConnectDerbyDAO.java:107)
        at model.dao.DerbyDAOFactory.buildDB(DerbyDAOFactory.java:57)
        at view.Main.main(Main.java:51)
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:derby:schoolofdb
        at java.sql.DriverManager.getConnection(DriverManager.java:602)
        at java.sql.DriverManager.getConnection(DriverManager.java:154)
        at model.dao.ConnectDerbyDAO.createDatabase(ConnectDerbyDAO.java:192)
        at model.dao.ConnectDerbyDAO.<init>(ConnectDerbyDAO.java:119)
        at model.dao.ConnectDerbyDAO.<init>(ConnectDerbyDAO.java:107)
        at model.dao.DerbyDAOFactory.buildDB(DerbyDAOFactory.java:57)
        at view.Main.main(Main.java:51)
Java Result: 1
BUILD SUCCESSFUL (total time: 6 seconds)

Thank you.

After setting the environment variables ensure that they are properly set by checking the same using echo %yourvar% .

You need to run the setEmbeddedCP.bat file *after* setting DERBY_HOME. SOmething like:

c:\> set DERBY_HOME=c:\path\to\derby\home
c:\>setEmbeddedCP.bat

Alternatively, you can set the environment variable in your global environment settings rather than setting it for every session. Right click My Computer -> Properties -> Advanced -> Environment Variables.

IMO better set the classpath when spawning your JVM process rather than messing with the CLASSPATH variable.

java -cp .;c:\derby\somejar;c:\derby\anotherjar

If this is a standalone application, consider better means of packaging rather than relying on environment variables and relative paths of jars. Eclipse provides a way of exporting a runnable JAR which flattens all the dependent JARs along with your class files in a single-standalone jar.

If this is a standalone application, consider better means of packaging rather than relying on environment variables and relative paths of jars. Eclipse provides a way of exporting a runnable JAR which flattens all the dependent JARs along with your class files in a single-standalone jar.

After my computer crashed I am in the process of setting everything up again. Which made me think that If I can't even set the paths etc how is someone else supposed to use my app
with out having to set all these variables. Is this eclipse feature you mentioned unique to eclipse? will I need to switch IDE'S and learn Eclipse? It sounds like this standalone jar is the best way to go.

I'd like to ask too, I have added a program to my sendTo folder (vista) so I can right click a .zip or any file and send it to this program "md5sums" that does something to
verify if the signed download has been altered from its original creation. Does any one know how this is supposed to work?


out put from md5Sums[\b]

MD5sums 1.2 freeware for Win9x/ME/NT/2000/XP+
Copyright (C) 2001-2005 Jem Berkes - http://www.pc-tools.net/
Type C:\Users\Steve\AppData\Roaming\Microsoft\Windows\SendTo\md5sums.exe -h for
help

[Path] / filename                              MD5 sum
-------------------------------------------------------------------------------
[C:\Users\Steve\Documents\ceyesumma\java_cache\]
db-derby-10.5.3.0-bin.zip                      a1461f9b08e00ce4f5ec0d48928299c2

Press ENTER to exit


Besides the normal command line usage (see examples above), MD5sums
can also be easily added to the windows shell. Use Windows Explorer
to access your user profile directory (one level up from the "Start
Menu" directory). Locate the "SendTo" folder and create a shortcut
inside it to "md5sums -p" (pause before returning).

Because my app looks for the var: drivername and I can't seem to find anything but a html file with anything close to the file name needed. To top it off I am not even sure what I am looking for in the first place but it does not seem to be in the .zip I downloaded.


output from app looking for a driver

run:
CLASS 
java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
ConnectDerbyDAO: 
 --> in ConnectDerbyDAO(schoolofdb) var: schoolofdb <-- 
 : xml dbProperties.getProperty:
org.apache.derby.jdbc.EmbeddedDriver
CLASS 
ConnectDerbyDAO: 
 --> in ConnectDerbyDAO(schoolofdb) var: schoolofdb <-- 
 : org.apache.derby.jdbc.EmbeddedDriver:var :driverName 

CLASS 
ConnectDerbyDAO: 
 --> in ConnectDerbyDAO(schoolofdb) var: schoolofdb <-- 
 : : caller 
--->: loadDatabaseDriver(org.apache.derby.jdbc.EmbeddedDriver) : var: driverName <-----

 --> in loadDatabaseDriver(org.apache.derby.jdbc.EmbeddedDriver) var: driverName <-- 

        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at model.dao.ConnectDerbyDAO.loadDatabaseDriver(ConnectDerbyDAO.java:211)
        at model.dao.ConnectDerbyDAO.<init>(ConnectDerbyDAO.java:149)
        at model.dao.ConnectDerbyDAO.<init>(ConnectDerbyDAO.java:136)
        at model.dao.DerbyDAOFactory.buildDB(DerbyDAOFactory.java:57)
        at view.Main.main(Main.java:51)
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:derby:schoolofdb
        at java.sql.DriverManager.getConnection(DriverManager.java:602)
        at java.sql.DriverManager.getConnection(DriverManager.java:154)
        at model.dao.ConnectDerbyDAO.createDatabase(ConnectDerbyDAO.java:230)
        at model.dao.ConnectDerbyDAO.<init>(ConnectDerbyDAO.java:152)
        at model.dao.ConnectDerbyDAO.<init>(ConnectDerbyDAO.java:136)
        at model.dao.DerbyDAOFactory.buildDB(DerbyDAOFactory.java:57)
        at view.Main.main(Main.java:51)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

thanks

It isn't a feature which is exclusive to Eclipse though if you are programming in Eclipse, that solution would make the most sense. Other standalone solutions like One-jar exist (complementary article). IMO, it is *the* solution to follow if running your application currently involves hunting down jar files.

I'd like to ask too, I have added a program to my sendTo folder (vista) so I can right click a .zip or any file and send it to this program "md5sums"

I don't see how this relates to your original query? Anyways, in simple terms, a MD5 checksum is a unique (well, almost) sequence of characters generated based on the file contents and is mainly used for verifying file integrity. E.g. you are trying to download a file from "teh" internet which also advertises a MD5 checksum. After the file download has complete, you can run a MD5 computation utility of the same file and check whether the advertised MD5 checksum is the same as the checksum computed for your local file. If it isn't, something wrong happened during the transit. For more technical details, refer the Wikipedia article for more details.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.