aspose file tools
The moose likes JDBC and the fly likes good select statement but does not run in java jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "good select statement but does not run in java jdbc" Watch "good select statement but does not run in java jdbc" New topic
Author

good select statement but does not run in java jdbc

John Nicer
Greenhorn

Joined: Oct 08, 2009
Posts: 7
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

Joined: Nov 24, 2005
Posts: 14672
    
  11

It does not work ? What's the error ?


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: good select statement but does not run in java jdbc
 
Similar Threads
PreparedStatement binding not working properly (Oracle Problem?)
com.thinweb.tds.Driver for Ms SQL 7
OrindaBuild 3.0 - Generates Java to call Oracle SQL Statements and PL/SQL procedures
OrindaBuild Now Supports Oracle 10G and JDeveloper 10G
OrindaBuild 4.0 - Writes Java to access Tables, PL/SQL and SQL Files