Hello guys,

I've written my very first program in JAVA for jdbc connection with mysql as
below:-

[root@base laxman]# cat database.java
*import java.sql.*;*
*   class database
     {
      public static void main(String args[]) throws Exception
       {
        //register driver
        DriverManager.registerDriver(new com.mysql.jdbc.Driver());*
*        //Establish connection
        Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test?user=root&password=redhat");
*
*        //Create a sql statement
        Statement stmt=con.createStatement();*
*        //Excecute the statement
        ResultSet rs= stmt.executeQuery("show databases");*
*        //retrieve from resultset and desplay data
        while(rs.next())
          {
                System.out.println(rs.getString(1));
          }*
*        //close connection
        con.close();
    }
}*

[root@base laxman]#
but when I try to compile it, it's giving me following error:-
[root@base laxman]# javac database.java
database.java:8: package com.mysql.jdbc does not exist
        DriverManager.registerDriver(new com.mysql.jdbc.Driver());
                                                       ^
1 error
[root@base laxman]#

Please help me to compile it.

Thanks in advance.

Regards,
Raj

-- 
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to