File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Invalid handle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Invalid handle" Watch "Invalid handle" New topic

Invalid handle

Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 265
Hello Ranchers!!
Here i've done some programs in jsp and oracle.. using jdbc connection

i can able to insert some thing to the database using the insert in to query and the prepare statement

but when i try to search the records from the database using the
select query and the prepare statement..
it is showing some error...!!
this is my program
Connection dbCon1;
dbCon1 = DriverManager.getConnection(dbURL,"ware","ware");
String query1 = "Select * from details where itemno = "+"'"+itemno+"' order by datein";

Statement stmt1 = dbCon1.createStatement();
ResultSet rs1 = stmt.executeQuery(query1);
// declaring the variables

String it="";
Date descr;
int in;
String denotein="";
String container="";
String spedagref="";
int qout;
String mj="";
String spurel="";
String spudelnote="";
String dest="";
int bala;
int packs;
Double volume;
Double totvol ;
int i=1;

descr= rs.getDate(2);
in= rs.getInt(3);
denotein= rs.getString(4);
container= rs.getString(5);
spedagref= rs.getString(6);
qout= rs.getInt(7);
mj= rs.getString(8);
spurel= rs.getString(9);
spudelnote= rs.getString(10);
dest= rs.getString(11);
bala= rs.getInt(12);
packs = rs.getInt(13);
volume = rs.getDouble(17);
totvol = rs.getDouble(18);

it is showing the error!!

java.sql.SQLException: Invalid handle

Can u please check this code and tell me.. is there any change i have to made!!

thanks in advance!!
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 265
sorry ranchers..
it was my mistake only

i put.. rs instead of rs1..


the code is now correct and is executing with out an error!!
now another doubt..

now i can retreive the datas from the table!!
some datas which are not important!!
it is shwoing the null value

i want to remove the null from the display!!

how can i change that null value!!

please help me in this ranchers
Sathya Prabhu

Joined: Mar 10, 2006
Posts: 12

You can avoid null values while retrieving data from the table itself.All u need to do is modify the select statement using nvl function.

But you have not clearly mentioned what null values you want to avoid.Just post your problem clearly so that otehrs can help you out.

I agree. Here's the link:
subject: Invalid handle
It's not a secret anymore!