help

35 pts.
Tags:
Java code
Java Database
PRG
class Orc { public static void main(String args[])throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:oradsn","system","sekhar"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select id from fhtml where fname ='s'"); while(rs.next()) { System.out.println(rs.getString(1)); } con.close(); } } hai is it possible to give input and execute it if yes than y my prg is not working please help me

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    Vegisekhar, you will have to provide more details. What exactly do you mean by 'is it possible to give input and execute it' ? '...is not working' Are you getting errors ? If so, what are the error messages ? How are you trying to run the program ?
    69,160 pointsBadges:
    report
  • Vegisekhar
    sir i want to give the condition by giving input suppose retrieve the rows less than > a and that a is input through keyboard if i give 50 it has to retrieve less than 50 if i give 100 than it has to give less than 100 did u get my point ?when i execute it its not retrieving anything simply it comes out
    35 pointsBadges:
    report
  • carlosdl
    The first thing I noticed is that you are reading user input into a variable named s, but that variable is not used in the rest of your code, so the query you are executing has nothing to do with what the user entered. Your query is trying to retrieve records in which the fname column is equal to 's' (as a literal). If what you want to do is to use the entered text as a condition for the query, you should parameterize your query or (not recommended for security reasons) concatenate the entered value (s variable) in your query string.
    69,160 pointsBadges:
    report
  • Vegisekhar
    oh thanku sir i will try
    35 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following