db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nshaw <...@docharley.com>
Subject RE: Problem with Class.forName
Date Sun, 25 Aug 2013 15:23:53 GMT
I ran the commands and here is the output:


Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.


C:\Users\Doc>java org.apache.derby.tools.ij

ij version 10.8

ij> connect 'jdbc:derby://localhost/c:/Users/Doc/Documents/Java



Since I haven't used ij, I'm assuming because I didn't get an error that it
is connecting to the database.


As I mentioned in my original e-mail, I've tried a lot of different examples
posted on the Internet. I wonder if one of them had me change something that
is affecting the CLASSPATH.  I checked 'Tools/Java Platforms' and other
places without success.  I did have two versions of the JDK so I uninstalled
v.7.0.11. I also had two versions of Netbeans.  I uninstalled the 2011
version and tried - didn't solve the problem. I then uninstalled NetBeans
7.3.1 and reinstalled it. It did change the default Java platform under
'Tools' but other than that, same issue.  No matter what I try, I keep
throwing exceptions at Class.forName().  


I can create Derby DB's through NetBeans, I can create tables and I can run
SQL commands without issue. But I can't do the same through a program.
Frustrating.  I thought that maybe Oracle had changed the Class.forName() to
something else like "org.oracle.javadb." or something like that - nope.  I
even tried the embedded driver - same thing.


Bryan, I really appreciate the help you've provided.  I don't know where to
go at this point except start exploring using Oracle 11g; however, I'm not
sure I won't have the same problem.  I could try using Eclipse and see what

Best Regards,




From: Bryan Pendleton-3 [via Apache Database]
Sent: Saturday, August 24, 2013 6:12 PM
To: nshaw
Subject: Re: Problem with Class.forName


> Here's the output: 
> java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver 


It sure seems like a classpath problem, but you can find the 
class when you run simple utilities like ij or sysinfo. 

Perhaps the classpath that your application is running with is 
somehow different, or perhaps something else is interfering with 
loading the class. 

You could try something like this: 
to have your application dump the classpath to see if it's what 
you expect it to be. 

Two more things to try: 

1) Run 'java org.apache.derby.tools.ij', then do 


    That will at least prove 100% that you can connect to your database 
    using the ClientDriver, from "ij". 

2) Run your test program with 'java -verbose:class', which might give 
    you some clues about where it's looking for classes. 

Here's a web page with other things you could try: 


One other thing occurs to me: I know that sometimes there can be 
multiple copies of Derby installed on the system, and if the 
multiple copies are of multiple different versions, that can 
disrupt the class loading. So if you have more than one copy of 
Derby on your system, make sure that your CLASSPATH is as narrow 
as possible and only includes the Derby that you intend to run. 



If you reply to this email, your message will be added to the discussion


To unsubscribe from Problem with Class.forName,
MTQ4NjY=> click here.

View this message in context: http://apache-database.10148.n7.nabble.com/Problem-with-Class-forName-tp133422p133439.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.
View raw message