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


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to