Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SQL Exception Invalid Descriptor Index

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String b1="select a.material_no, a.po_unit, a.po_qty, a.recv_qty,a.last_recv_date,
a.poclosed_flg, b.material_nm from po_dtl a,material_mst b where a.section_c='"+c+"' and
a.po_no='"+e+"' and a.material_no=b.material_no";

rs=stmt.executeQuery(b1);
while(rs.next())
{
j= rs.getString("material_no");
k= rs.getString("material_nm");
//l= rs.setString("po_unit");
//m= rs.getInt("po_qty");
//n= (int)(rs.getInt("recv_qty"));
//o= rs.getDate("last_recv_date").toString();
//p= rs.getString("poclosed_flg");
ABOVE IS MY CODING.IN ALL THE COMMENT STATEMENTS I M GETTING AN SQL ERROR WHILE MY PROGRAM RUNS INVALID DESCRIPTOR INDEX.
CAN U HELP ME TO RESOLVE IT.
 
David Freels
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by anurag mittal:
String b1="select a.material_no, a.po_unit, a.po_qty, a.recv_qty,a.last_recv_date,
a.poclosed_flg, b.material_nm from po_dtl a,material_mst b where a.section_c='"+c+"' and
a.po_no='"+e+"' and a.material_no=b.material_no";

rs=stmt.executeQuery(b1);
while(rs.next())
{
j= rs.getString("material_no");
k= rs.getString("material_nm");
//l= rs.setString("po_unit");
//m= rs.getInt("po_qty");
//n= (int)(rs.getInt("recv_qty"));
//o= rs.getDate("last_recv_date").toString();
//p= rs.getString("poclosed_flg");

Try using this:
j= rs.getString(1);
k= rs.getString(7);
l= rs.setString(2);
m= rs.getInt(3);
n= (int)(rs.getInt(4));
o= rs.getDate(5).toString();
p= rs.getString(6);
-OR-
Use the resultset metadata to view the column names that are being returned. Each db handles this diffrently and since you are performing a simple join, the db may be sending the name back with the table alias prefix.
Hope this helps.
David
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!