This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 1659
    
  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: 24183
    
  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: 38045
    
  22
Most things appear somewhere in the Java Tutorials and this is no exception
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
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: 1659
    
  11

Thanks a lot!

 
Don't get me started about those stupid light bulbs.
 
subject: VERY basic question about MySQL database access from Java
 
Similar Threads
NetBeans IDE 5.0 = how to connect my database
Eclipse (Mac): Access restriction: The constructor Driver() is not accessible due to restriction...
Netbeans classpath problem
can't access database
How to send a J2EE web application linked to mysql database to others?