The Artima Developer Community
Sponsored Link

Java Answers Forum
querying an Oracle database using Java

1 reply on 1 page. Most recent reply: Dec 12, 2009 5:35 AM by David Rozenberg

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
lily will

Posts: 2
Nickname: good88
Registered: Dec, 2009

querying an Oracle database using Java Posted: Dec 10, 2009 11:39 PM
Reply to this message Reply
Advertisement
Basically I'm developing a system which uses an artificial neural network to predict diagnoses for patients. The patients will select their symptoms in the form of checkboxes. I was just wondering how you would go about querying a database using the checkbox label.
E.g., JCheckBox btn = new JCheckBox("Nausea", false);

So when this checkbox is clicked the database is queried to find diagnosis which contain nausea as a symptom. I realise you can do a ResultSet r = new ResultSet("Select * FROM Login") but how would you do this by using the checkbox's label? I.e., Result r = new ResultSet("SELECT btn.getText() FROM Login)
I have looked everywhere but can't find anything to guide me. Any help would be appreciated so I can get an idea. :)

Thank you :)


David Rozenberg

Posts: 15
Nickname: drozenbe
Registered: Nov, 2009

Re: querying an Oracle database using Java Posted: Dec 12, 2009 5:35 AM
Reply to this message Reply
There are two things that are obviously missing in what you tried to describe.
First, you may need to consult the documentation for Swing API related to JCheckBox and CheckBox. There is API that allows to determine the state and the selected item in the group. That will allow you to put the right value in your query.
Second, the query you wrote should have the "WHERE' part. Here you need to specify how you want to constrain your search. The name of the column should match the actual column in the table and the value should be the one from the check box. Here is another recommendation. To get better results with queries you may need to split the query into two parts: first you need to prepare the query, then you need to provide the value from the check box and actually execute the query. This way when your application needs to search for different items in the database you save a lot of time on binding the query to the database,

Flat View: This topic has 1 reply on 1 page
Topic: How to turn Photos into  photo slideshow? Previous Topic   Next Topic Topic: Mortgage Homework

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use