This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

MySQL Connection in Eclipse 3.2

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

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:

Class.forName(driverName);
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"nijava", please check your private messages.
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



Eclipse has this plugin: Eclipse Data Tools Platform
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic