preparedstatement p= new preparedstatement
is it possible ?
Answers were Sorted based on User's Feedback
Answer / satya veni
No.Interfaces can not be instantiated.
PreparedStatement ps=con.PreparedStatement("query");
Is This Answer Correct ? | 27 Yes | 2 No |
Answer / suresha
No,It should be following syantx
Preparestatement ps=con.preparestament("some query");
Is This Answer Correct ? | 13 Yes | 3 No |
Answer / suresha
correction.
Preparedstatement ps=con.Preparestatement("some query");
suresha
Is This Answer Correct ? | 13 Yes | 4 No |
Answer / venkatesh
Correction. Syntax should be....
PreparedStatement ps = conn.prepareStatement("Query");
Thanks.
Is This Answer Correct ? | 10 Yes | 2 No |
Answer / abc
No,Syntax..............
PreparedStatement st=con.prepareStatement("query");
Thanks!
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / t.l.n.prasad
no becoz PraparedStatement is an interface we can't
instantiate direcly but we can instantiate like this
PreparedStatement ps=con.PreparedStatement("Query");
where "con" is an Object of Connection interface
ie
Connection con=DriverManager.getConnection();
Is This Answer Correct ? | 7 Yes | 3 No |
Answer / surya, samcomm technologies pv
yes, but that is not the way to create object for the
interface. using Anonymous inner class.
syntax...
PreparedStatement ps=new PreparedStatement() {
U should implement all the methods of this
interface inside this block.
};
or if u feel this is overhead, then simply get the
reference for this interface in the following way.
PreparedStatement ps=con.prepareStatement("query");
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / chandrakala
No, the statement must be look like this
PreparedStatement p=new perpareStatement("query");
Is This Answer Correct ? | 6 Yes | 16 No |
What is jdbc and why is it required?
What is a statement in java?
any one can explain about policy file rule? when i connect database with applet then ther is no compile time error but the run time error is occureed.i.e access is denied.policy file rule is related to this problem.
what are the Different types of exceptions in JDBC?
How to achieve JDBC Connection Pooling using JDBC DataSource and JNDI in Apache Tomcat Server?
How many packages are available in jdbc api?
Hi my doubt is that preparedStatement is a interface means which has no implemenation.plz go thru the code below String sql = "SELECT * FROM movies WHERE year_made = ?"; prest = con.prepareStatement(sql); prest.setInt(1,2002); ResultSet rs1 = prest.executeQuery(); Now setInt and executeQuery how it works since it is interface it does not have implementation how it works, how executeQuery returns result from database as executequery method has no implementation even in Statement interface.
4 Answers Cybermate, Hexaware,
What is an SQL Locator?
How can I write to the log used by DriverManager and JDBC drivers?
How can we disable a constraint ?
What is metadata in java programming?
explain about special characters?