Jump to content

Welcome to PakSarZameen Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

Need Help - Java app with a database

- - - - -

  • Please log in to reply
6 replies to this topic

#1
mmmusa8888

mmmusa8888

    Titty Master

  • Super Mods
  • 6235 posts
  • LocationQuebec to Manama

Guys, help me out here.

 

I'm making a Java JDBC System for a Shop Inventory in which I can search, modify and add data in the db via a GUI.

 

Can anyone give me any tips or guidance on this. I need it

 

 


tumblr_n6ppy7jo3C1qfpe3mo2_500.gif


#2
Sarmad

Sarmad

    Ustaad

  • Administrators
  • 1072 posts
Do you have to use Java? It wouldn't be my first choice....

In any case, I'd recommend a three tier design.

Tier 1: a class that does only database work. This is where JDBC comes in, and all of your queries, etc. Make functions for each type of query. The function will do all of the database work, and will return a simple String, ArrayList, etc. Nothing outside of this class should ever know or care about the database.

Tier 2: this is where all of your logic is. For example, let's say one of your requirements is that you can add something to the database, but it has to be less than 20 characters long. You would write a function that takes a String as an argument, checks the length, and then calls a function in Tier 1 to save it to the database.

Tier 3: this Tier has only your Web application or front-end that is shown to the user. It just renders the page, takes input, and calls a function in Tier 2 to do whatever it needs to do.

#3
mmmusa8888

mmmusa8888

    Titty Master

  • Super Mods
  • 6235 posts
  • LocationQuebec to Manama

I have to use Java, its part of my Project

 

Thanks for the suggestion, the part I'm facing difficulties is linking the GUIs with the db sql queries

 

So far I've made two classes

 

First class is where I've stored the functions and queries related to db as you mentioned

 

Second class, is a DAO class where I make the connection to the database etc

 

So now I'm confused on how to approach for a GUI :think:

 

I basically don't know how to use Java Swing with db :confused:


tumblr_n6ppy7jo3C1qfpe3mo2_500.gif


#4
Sarmad

Sarmad

    Ustaad

  • Administrators
  • 1072 posts
Don't worry about the database. Just approach it like you're making a simple app with no database at all.

To start, make a Swing app that just has a text box and a button, which will call a function and send along the text. Have that function print the String or something so we know it's working.

Once you have that working, just make one change. Instead of printing the String, change your function to call your other function which does the query.

Try this out. If you get stuck, post your code here. I think the forum post editor has a function to paste code. If not, just zip up your files and attach.
  • PB. likes this

#5
ayesh

ayesh

    Ensign

  • Members
  • Pip
  • 74 posts

thanks for sharing

http://fde.result.pk/



#6
nazimalik

nazimalik

    Ensign

  • Members
  • Pip
  • 11 posts
  • Locationlahore pakistan
Our website, BeEducated.pk, has started providing job advertisements for people seeking jobs in Pakistan. You can see variety of jobs in different sectors. Here you can find jobs related to media, finance and almost every department. With our website you will be able to find your desired job with the best salary offer. Our dedicated team adds latest jobs available in all over Pakistan on daily basis. So visit BeEducated.PK to make a successful career in your respective field of interest.
 
All sorts of jobs in Pakistan are provided here:
 
Latest jobs in Pakistan
 
 
 
 


#7
fahadzafar

fahadzafar

    Ensign

  • Members
  • Pip
  • 35 posts

nice sharing http://news.mobile-phone.pk/software/






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users