File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes SQL Exception Invalid Descriptor Index Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Exception Invalid Descriptor Index" Watch "SQL Exception Invalid Descriptor Index" New topic
Author

SQL Exception Invalid Descriptor Index

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Feb 01, 2001
Posts: 102
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Exception Invalid Descriptor Index
 
Similar Threads
problem to connect to SQL server 7
Another Question about datetime
problem in browsing
[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
Invalid Descriptor Index