You may need to add the mysql jar to your class path. The easiest way will be to go the properties of you project and add the mysql library.
Godwin S. Grey --- On Sun, 12/28/08, K M Nur <kamruddin....@gmail.com> wrote: From: K M Nur <kamruddin....@gmail.com> Subject: [java ee programming] jdbc problem To: java-ee-j2ee-programming-with-passion@googlegroups.com Date: Sunday, December 28, 2008, 2:27 PM I'm trying to get connected to my mysql server running in linux using the following method - private static Connection getConnection() { Connection con = null; try { System.out.println("test: not working after that.. .why? find out!"); Class.forName("com.mysql.jdbc.Driver"); System.out.println("test"); String url = "jdbc:mysql://localhost:3306/Movies"; String user = "root"; String pw = ""; con = DriverManager.getConnection(url, user, pw); } When I build and run in netbeans 6.1 I get the following output - test: not working after that.. .why? find out! com.mysql.jdbc.Driver When I try the following - Connection con = null; try { // Load the MySQL JDBC driver Class.forName("com.mysql.jdbc.Driver") ; System.out.println("MySQL JDBC driver loaded ok."); } catch (Exception e) { System.err.println("Exception: "+e.getMessage()); } I get the following output - Exception: com.mysql.jdbc.Driver I can see my mysql databases in the services window (when I select and right click on the database I'm trying to connect from the code it can connect with database) and it shows my database. However the above codes not working... What am I doing wrong? Please help. -- Regards, K M Nur Mobile : +88-01914 064920 Tech Blogs & Schedules: http://k-linuxtechs.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en -~----------~----~----~----~------~----~------~--~---