This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

It is very urgent please help…

 
Ahmed Ali
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that I have 3 table (customer,address,telephone) one customer have one or maximum 3 addresses and each address having 3 different telephone nos. I want, to give just customer id (as: cid=7123) and extract all addresses and telephones nos. of particular customer. I am applying the following query in Java Bean file.
(I am using Access Dirver in JDBC)
"SELECT a.cid, a.cname, b.addressid, b.description, c.addressid, c.telenumber FROM customers a, caddress b, ctelephone c WHERE a.cid=b.cid and b.addressid =c.addressid and a.cid=0001;

but the Exception is :
SQLException : java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Invalid descriptor index
(Note: This is run able query in Microsoft Access
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ahmed Ali:
The problem is that I have 3 table (customer,address,telephone) one customer have one or maximum 3 addresses and each address having 3 different telephone nos. I want, to give just customer id (as: cid=7123) and extract all addresses and telephones nos. of particular customer. I am applying the following query in Java Bean file.
(I am using Access Dirver in JDBC)
"SELECT a.cid, a.cname, b.addressid, b.description, c.addressid, c.telenumber FROM customers a, caddress b, ctelephone c WHERE a.cid=b.cid and b.addressid =c.addressid and a.cid=0001;

but the Exception is :
SQLException : java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Invalid descriptor index
(Note: This is run able query in Microsoft Access

1. make sure you use a proper index number( 1 - 6 in your case ) or column name when using rs.getXXX() methods
2. if you have an older driver, you have to retrieve the column values in the order the appear in your query.
if those 2 suggestions don't work, then post the relevant jdbc code ( statement and resultset ) snippet.
Jamie
This may just
 
Rajakumar Makapur
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I hope you are using jdbc odbc driver.
Go for microsoft or jnet driver.
regards
Rajakumar.
 
iborg
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the exception occuring on the execution of the query or when you attempt to access a value from the ResultSet? If the former, check to make sure you have a primary key index on each table - this may not be your particular problem, but I've seen similar problems occur when trying to access ACCESS tables that do not have a primary key index.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic