• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Non web java programs to access MySql database

Posts: 4
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to write some simple programs in java that do NOT use a web browser interface and manipulate/display data from a MySql database. The database and programs would reside on the same pc and networking would not be involved. Although eventually I would like to make the programs network compatible. These programs are for a small club I belong to and will manage their membership database and track fundraising activities. What I am asking is what tools do I need to use to make the interface/gui, what would be the easiest? I know this is probably subjective, but it will be nice to have several recommendations to consider. I have experience with other programming languages and did take a night class on java, but I do need to start from the beginning. As for the database, I know exactly how I want that setup and have all the tables and fields defined.

Thank for any help/suggestions you can give.

Posts: 43016
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

For the GUI, the preferred API these days is JavaFX: http://docs.oracle.com/javase/8/javase-clienttechnologies.htm

For the DB access you'd use the JDBC API: http://docs.oracle.com/javase/tutorial/jdbc/index.html. You'd need to download the JDBC driver from the MySQL site.
Ranch Hand
Posts: 198
Oracle Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the simple java program for mysql.
Posts: 10777
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Fred Schauer wrote:Thank for any help/suggestions you can give.

Not being a GUI expert, I doubt I can better Ulf's suggestion, but here's my tip:

Keep the GUI and your application logic completely separate. A Member, for example, is likely to be a data (or 'business') object, not a display item, so I wouldn't expect it to contain ANY code for displaying; apart from possibly a toString() method for debugging purposes.

That doesn't mean that you can't pass one to a class that does know how to display it (or part of it) properly, but don't mix the two together.

A nice side-effect of this is that you can write and test your application classes and logic (possibly including database access) without even worrying about the display - apart from making sure that it's readable on a console. This allows you to focus on one thing at a time.

Displays are notoriously fiddly and verbose beasts, and, while I understand that Java FX has greatly reduced the amount of faffing about you have to do, it's natural that when you're writing screens, you'll be concerned with things like format and placement and "feel", which have nothing whatsoever to do with what a Member does.

You may be interested in reading up about the MVC pattern, which goes into a bit more detail about this.


Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic