Hi Hastsy, Please always use the *Reply All* option in your email client to send your reply to the whole list. Your last reply was sent to me and not the list or the OP. Which meant that the OP and the group members didn't get your reply.
So, I've included your reply below for the list <Hantsy's response> Firstly , put mysql jdbc driver into your project library at development phase. If you deploy a war package on application server , I suggest you copy your driver to your app server lib directory and do not package it within the war file. Tomcat works good if you package mysql jdbc driver into war file, but other JDBC driver may not work at this way. </Hantsy's response> --Evans http://www.javawug.org ----- Original Message ----- From: "Hantsy Bai" <han...@gmail.com> To: <fiveholida...@hotmail.com> Sent: Tuesday, December 30, 2008 4:18 AM Subject: Re: [java ee programming] Re: jdbc problem > Evans wrote: >> It looks like you don't have the driver in your classpath for it to be >> used by your simple application. >> If you haven't already downloaded it, head over to mysql site and grab >> yourself the driver and add it to your project path. >> Again, always make sure you have a small runnable code sample to help >> reproduce the same issue. this should help us run the code and see where >> the problem lies. >> The code you included does not show us any mistakes you may have in the >> rest of the code. >> Good luck >> --Evans >> http://www.javawug.org >> ----- Original Message ----- >> >> *From:* K M Nur <mailto:kamruddin....@gmail.com> >> *To:* java-ee-j2ee-programming-with-passion@googlegroups.com >> <mailto:java-ee-j2ee-programming-with-passion@googlegroups.com> >> *Sent:* Sunday, December 28, 2008 10:27 PM >> *Subject:* [java ee programming] jdbc problem >> >> 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 >> >> >> >> >> > Firstly , put mysql jdbc driver into your project library at development > phase. > If you deploy a war package on application server , I suggest you copy > your driver to your app server lib directory and do not package it within > the war file. Tomcat works good if you package mysql jdbc driver into war > file, but other JDBC driver may not work at this way. > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---