List:General Discussion« Previous MessageNext Message »
From:shane Date:July 13 2001 6:11pm
Subject:jdbc works on win2000 but not on linux rh7.0
View as plain text  
i've written a java file to connect to the database in a linux rh7 os. the
file runs fine on a win2000 os so i think that there is no problem with the
code. I've set my class path to the dir where i've downloaded the
mm.mysql.jar file and the path set to my jdk1.3.1/bin and jdk1.3.1/lib
directories  using the export PATH = /usr/.../jdk1.3.1/bin = $PATH but the
code still gives me the error.

Is my way of setting the path wrong?
Do i need to do anything else to get the source code to work?

the source is :
import java.sql.*;
import java.util.*;

public class Connected {
	public static void main (String[] args) throws Exception{
		Connection con = null;

		try{
                        String url =
"jdbc:mysql://localhost:3306/databasename";
			Statement stmt;
			ResultSet rs;
			Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                        System.out.println("Class.forName");

                        con =
DriverManager.getConnection(url,"user","password");
 			stmt = con.createStatement();
		}
		catch(SQLException e) {
			System.out.println("Unable to load driver.");
			e.printStackTrace();
		}
		finally{
			if (con != null){
				try{con.close();
			}
			catch (Exception e){}
		       }
		}
	}
}


Thks

Thread
jdbc works on win2000 but not on linux rh7.0shane13 Jul