File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Classpath issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Classpath issues" Watch "Classpath issues" New topic
Author

Classpath issues

Jim Panagiotopoulos
Greenhorn

Joined: Aug 05, 2001
Posts: 11
Hi everyone!
I have a classpath problem where I have a database called wrox4370.db(located in c:\wrox\database\Wrox4370.db) that I'm trying to access with the MakingTheConnection class(located in the same directory).
import java.sql.*;
public class MakingTheConnection {
public static void main(String[] args) {
// Load the driver
try {
// Load the driver class
Class.forName("COM.cloudscape.core.JDBCDriver");
// Define the data source for the driver
String sourceURL = "jdbc:cloudscape:Wrox4370.db";

// Create a connection through the DriverManager
Connection databaseConnection =
DriverManager.getConnection(sourceURL);
// We made it!
System.out.println("Connection established successfully!");
// close connection
databaseConnection.close();
}
catch (ClassNotFoundException cnfe) {
System.err.println(cnfe);
}
catch (SQLException sqle) {
System.err.println(sqle);
}
}
}
I have compiled the class successfully but am at a loss as to how to run it using java -cp and/or java -classpath. I usually get an SQLException."Wrox4370.db" not found.
My understanding of classpath is fuzzy .Does anyone have any insight into this problem?

Thanks
Jim

Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
You should run java with the switch -classpath c:\wrox\database;OTHER_JAVA_STUFF
have you tried without the extension ".db" ? I mean like this:
String sourceURL = "jdbc:cloudscape:Wrox4370";
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
[This message has been edited by Valentin Crettaz (edited November 16, 2001).]


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Classpath issues
 
Similar Threads
Connection Problem
Can't connect to Oracle database
JDBC Driver for Sql Server Class not found Exception
How to connect Driver
database connectivity