• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Non web java programs to access MySql database

 
Greenhorn
Posts: 4
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


Fred57
 
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is the simple java program for mysql.
http://j2ee-prabhakar.blogspot.in/2014/07/mysql-simple-jdbc-program.html
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

HIH

Winston
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic