Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Non web java programs to access MySql database

 
Fred Schauer
Greenhorn
Posts: 4
Eclipse IDE Java MySQL Database
  • 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.


Fred57
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • 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.
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 197
Java Oracle Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
 
Winston Gutkowski
Bartender
Pie
Posts: 10571
64
Eclipse IDE Hibernate 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.

HIH

Winston
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic