• 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
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Java accessing a database?

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can Java do it? If it can how do you go about doing it. For a final project for my class in Java(beginners), I want to have a program access and put information into and pull from a MySQL database then use that information to run the program. It's not really necessary for my idea but it would make the program a lot more user friendly.
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JDBC API, part of J2SE, is Java's database access API. Accessing MySQL is as simple as installing the Java driver distributed with MySQL and using this API.

We have a JDBC forumm here at the Ranch. I'm going to move this thread there, and perhaps other folks will give you more "getting started" tips.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a good place to start with.

Shahabas E Shabeer
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may also want to check out one of the DB Frameworks available. I personally use hibernate on a couple of projects and really like it.
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First things first. I'd get a good understanding of JDBC under my belt before diving off into something like Hibernate.
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggested above, you should start by finding out more about the JDBC API.

There's some good links above.

http://www.onjava.com/pub/a/onjava/excerpt/javaentnut_2/index1.html


Then you need to look at the area of data persistence and best practices. I suggest starting with a quick introduction to the J2EE Core Design Patterns before focusing on Data Access Objects.

http://www.corej2eepatterns.com/index.htm

http://www.corej2eepatterns.com/Patterns2ndEd/DataAccessObject.htm


At this stage, you've probably done enough to get full marks in your project.

A further step is to consider the technology choices available (JDBC DAOs, EJB CMP, JDO, Hibernate, etc). The final stage is perhaps the most difficult - you can read about some of the main choices here:

http://www.codefutures.com/weblog/corporate/archives/2005/02/data_persistenc.html


PJ Murray
CodeFutures Software
Java Code Generation for Data Persistence
 
pie. 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