Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / January 2006

Tip: Looking for answers? Try searching our database.

MySQL using Eclipse Mac OSX

Thread view: 
DrMatrix - 15 Jan 2006 20:10 GMT
I am using Eclipse 3.1 under Mac OS X 10.4.4. I just downloaded MySQL.

I installed MySQL successfully. I am able to create databases and
tables. And I am able to load them and run queries by running mysql.app.

I downloaded mysql-connector-java-3.0.17-ga and I have a .jar file but I
don't know how to tell Eclipse to look for it. Should I move the .jar
file somewhere, or do I have to do something in Eclipse?

Here is the code I copied:
//---------------------------------------
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
  // Notice, do not import com.mysql.jdbc.*
  // or you will have problems!
public class LoadDriver {
   public static void main(String[] args) {
       try {            // The newInstance() call is a work around for
           //some  
           // broken Java implementations
           Class.forName("com.mysql.jdbc.Driver").newInstance();
       } catch (Exception ex) {
           System.out.print(ex.toString());
       }
   }
}
//_________________________________

I get java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Roedy Green - 15 Jan 2006 23:03 GMT
>I downloaded mysql-connector-java-3.0.17-ga and I have a .jar file but I
>don't know how to tell Eclipse to look for it. Should I move the .jar
>file somewhere, or do I have to do something in Eclipse?

Right click on your project | properties | java build path

Add your jars in there.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

DrMatrix - 16 Jan 2006 05:12 GMT
> >I downloaded mysql-connector-java-3.0.17-ga and I have a .jar file but I
> >don't know how to tell Eclipse to look for it. Should I move the .jar
[quoted text clipped - 3 lines]
>
> Add your jars in there.

That did the trick.

Thank you.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.