Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query does not return data by using JDBC but it does in sql plus

843854Jul 12 2004 — edited Jul 12 2004
Hi:

I have a method that makes a query and return a vector, when i used it, the vector returned is empty, but if i execute the same query en sql plus, it show me the data......

public static Collection getVector()
throws SQLException{
String sql = "a select query";
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
Vector v = new Vector();
try{
conn = bdConnection.getConnection();
System.out.println(sql);
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while(rs.next()){
System.out.println("adding new Object");
v.add(new Object(rs));
}
return v;
}catch(SQLException ex){
System.out.println(ex.getMessage());
}
finally{
try{conn.close();}catch(Exception ex){}
}
}

Anyone knows were the problem could it be?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 9 2004
Added on Jul 12 2004
17 comments
2,456 views