aspose file tools*
The moose likes JDBC and the fly likes VERY basic question about MySQL database access from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "VERY basic question about MySQL database access from Java" Watch "VERY basic question about MySQL database access from Java" New topic
Author

VERY basic question about MySQL database access from Java

Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1667
    
  11

I have created a database using mySQL.

How do I access/manipulate that database from my Java application? The instructions for my project suggest using NetBeans, but I'm not keen on installing an IDE just for one project if there's another way (I'd also like to learn the right way.... I'm sure not everyone who uses databases with Java installs NetBeans...).

If someone could point out where to start......


When you do things right, people won't be sure you've done anything at all.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24185
    
  34

Hi Janeice,

Nope, you don't need NetBeans -- not even sure why someone would suggest that. You need to use the JDBC API, which is part of the standard JDK; it's the java.sql package. The API is the same for every database, but you need a "driver" -- a special JAR file -- for whatever database product you're using.

You can get the MySQL JDBC driver here. Here is the Java Tutorials section on JDBC, which is a decent introduction.


[Jess in Action][AskingGoodQuestions]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38896
    
  23
Most things appear somewhere in the Java Tutorials and this is no exception
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38896
    
  23
Damn! EFH beat me to it by two minutes.

And I think this thread would sit better on our databases forum. Moving.
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1667
    
  11

Thanks a lot!

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: VERY basic question about MySQL database access from Java