aspose file tools*
The moose likes JDBC and the fly likes Invalid handle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Invalid handle" Watch "Invalid handle" New topic
Author

Invalid handle

Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
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;

while(rs.next())
{
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);

%>
etc.....
__________________________________________________________________________
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: 263
sorry ranchers..
it was my mistake only

i put.. rs instead of rs1..

sorry..

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
Greenhorn

Joined: Mar 10, 2006
Posts: 12
Aravind,

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.


Sathya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid handle