I have a problem :
The Error Message is ->
An exception has been intercepted
at java.lang.Class.forName1(Native Method)
My Code is :
public class Database
public static void main( String args )
// Register MySQL driver
// Open a properties file where connection info is stored
FileInputStream infile = new FileInputStream( "db.properties" );
Properties props = new Properties();
// Connection info for MySQL
String dbserver = props.getProperty("dbserver", "localhost");
String dbname = props.getProperty("dbname", "test");
String user = props.getProperty("user", "root");
String password = props.getProperty("password", "");
String cs = "jdbc:mysql://"+dbserver+"/"+dbname+"?user="+user+"&password="+password;
// The SQL statement to execute
String sql = "SELECT * FROM daten";
// Open a connection to the database
Connection conn = DriverManager.getConnection(cs);
Statement stat = conn.createStatement();
// Execute the query
ResultSet rs = stat.executeQuery(sql);
// Display results
// Close everyting
catch (Exception ex)
System.out.println( "An exception has been intercepted" );
i dont know the Problem i am a Newbie
Setting the CLASSPATH (For Standalone Use)
Once you have un-archived the distribution archive, you can install the driver in one of two ways: Either copy the "com" and "org" subdirectories and all of their contents to anywhere you like, and put the directory holding the "com" and "org" subdirectories in your classpath, or put mysql-connector-java-[version]-bin.jar in your classpath, either by adding the FULL path to it to your CLASSPATH enviornment variable, or by copying the .jar file to $JAVA_HOME/jre/lib/ext. If you are going to use the driver with the JDBC DriverManager, you would use "com.mysql.jdbc.Driver" as the class that implements java.sql.Driver.
Example 2.1. Setting the CLASSPATH Under UNIX
The following command works for 'csh' under UNIX:
$ setenv CLASSPATH /path/to/mysql-connector-java-[version]-bin.jar:$CLASSPATH
The above command can be added to the appropriate startup file for the login shell to make MySQL Connector/J available to all Java applications.
Example 2.2. Setting the CLASSPATH Under Microsoft Windows 9X
The following is an example of setting the CLASSPATH under Microsoft Windows 95, 98, ME:
This command can be added as the last line in AUTOEXEC.BAT. If this is done the MySQL Connector/J driver will be made available to all Java applications that run on the Windows 9x system. This setting will require the computer to be rebooted before the changes will take effect.
I set the Creator/J to the system classpath on WinXP, but the code didn't work. I haven't made a jar yet to run without JCreator, so I don't know what happens with the class paths then.
This just seems to show that the class path can lie about anywhere.
Welcome to JavaRanch!
Note that this thread is 2 years old, so the original poster isn't looking for an answer anymore. For questions about JCreator, note that we have an IDEs forum down below.