wood burning stoves
The moose likes JDBC and Relational Databases and the fly likes MySQL Connection in Eclipse 3.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "MySQL Connection in Eclipse 3.2" Watch "MySQL Connection in Eclipse 3.2" New topic

MySQL Connection in Eclipse 3.2


Joined: Oct 01, 2008
Posts: 1

I am a beginner in Java and Eclipse.

I have installed Eclipse 3.2
I want to access MySQL Database in Java GUI program.

Can anyone give me simple step by step methods for setting up Database Connection.

Are there any nice free Database plugins for eclipse??

Thank you for help.
Martin Wingert

Joined: Oct 10, 2005
Posts: 16

Download the MySQL connector for Java from MySQL website (http://dev.mysql.com/downloads/connector/j/5.1.html) and put it in your classpath. Then create a connection and query away.

There are many tutorials for how to connect to the db but in short you load a driver and then get a connection:

String url = "jdbc:mysql://" + serverName + "/" + mydatabase; // a JDBC url
String username = "username";
String password = "password";
Connection connection = DriverManager.getConnection(url, username, password);

Then if you expect a lot of users of your app then you could add a db pool like apache.commons.dbcp or proxool.

Not sure what you mean with db plugins for Eclipse but if you mean a object/relational persistence and query service then look into http://www.hibernate.org/

Hmmmm...why have you installed an old version of Eclipse? Latest version is 3.4 Ganymede.

BR // Martin
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

"nijava", please check your private messages.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Originally posted by nijava:
Are there any nice free Database plugins for eclipse??

Eclipse has this plugin: Eclipse Data Tools Platform

Regards, Rene Larsen
Dropbox Invite
I agree. Here's the link: http://aspose.com/file-tools
subject: MySQL Connection in Eclipse 3.2
jQuery in Action, 3rd edition