35 pts.
 help
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

Software/Hardware used:
ASKED: March 8, 2012  7:24 AM
UPDATED: March 9, 2012  3:56 AM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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 ?

 63,535 pts.

 

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 pts.

 

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.

 63,535 pts.

 

oh thanku sir i will try

 35 pts.