• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

good select statement but does not run in java jdbc

 
John Nicer
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Geeks,
I wrote a SQL static class so that I can run as follow

String sql="select * from table where name = 'McDonald' "; // (A)

List<Row> list = SQL.query(sql); // (B)

(B) is implemented as follow:

class SQL
{
public static List<Row> query(String sql)
{
Connection con ....
preparedStament = con.getPrepared..

ResultSet result = preparedStatement.executeQuery(sql);

while(result.netx());
....
}

}

Say, the sql statement above works in PL/SQL but it does not work in JDBC, even this code was tested for many other sql statement. Is any pit fall that I encounter? Greatly appreciated.

Javee

The sql statement in PL/SQL works sucessfully and this code works for other SQL statements, too.
But why for one query
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does not work ? What's the error ?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic