Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help needed in debugging a connection problem between java and Apache derby database

 
Natasha Teokotai
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody

I am fairly new to Java and don't know much at all about debugging java programs

WEKA is a data mining program [out of Waikato University , New Zealand]

I am trying to connect to a database [see http://weka.wikispaces.com/How+do+I+connect+to+a+database%3F]

I am running Windows 7 - 32 bit, and Java 7
I call Weka as follows.................................
********************************
try {
new WekaApp().doInit();
myConsole.getOut().println("Weka initialization successful");
}
catch (Exception e)
{
myConsole.getOut().println("Weka exception occurred: "+e);
}

and the called code is as follows:-
*******************************
private class WekaApp() {
public BufferedReader readDataFile (String filename) {
BufferedReader inputReader = null;

try {
inputReader = new BufferedReader (new FileReader(filename));
} catch (FileNotFoundException ex) {
myConsole.getOut().println("File not found: " + filename);
}
return inputReader;
}
void doInit() throws Exception {
BufferedReader datafile = readDataFile("C/Databases/us_copiosus");

******************************************************
Error Results:-
File not found:C:/Databases/us_copiosus [the file us_copiosus is there!]
Weka Exception occurred:java.sql.SQLException: No suitable driver found for jdbc:derby:C:/Databases/us_copiosus
******************************************************
I have edited DatabaseUtils.props file as follows
jdbcDriver = org.apache.derby.jdbc.EmbeddedDriver
jdbcURL = jdbc:derby:C:\Databases\databasename

and have put this file in the recommended place after checking where user.home was

Any suggestions or advice most welcome

Bob Matthews
Research Assistant
Department of Surgical Sciences
University of Otago
Dunedin, New Zealand
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you added "derby.jar" to CLASSPATH?

If not,
1. Download the file "db-derby-10.10.1.1-lib.zip" from Derby download site

2. Extract it somewhere (say c:\derbydir). Under extracted directory's "\lib", there'll be a number of "derby*.jar" files.

3. Run your application with "derby.jar" included in CLASSPATH. For example:
java -cp c:\derbydir\lib\derby.jar;c:\wekadir\weka.jar <your_app_class>

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic