my dog learned polymorphism*
The moose likes JDBC and the fly likes It is very urgent please help… Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "It is very urgent please help…" Watch "It is very urgent please help…" New topic
Author

It is very urgent please help…

Ahmed Ali
Greenhorn

Joined: Aug 01, 2002
Posts: 1
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

Joined: Jul 09, 2001
Posts: 1879

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

Joined: Jun 23, 2001
Posts: 13
Hi,
I hope you are using jdbc odbc driver.
Go for microsoft or jnet driver.
regards
Rajakumar.
iborg
Greenhorn

Joined: Aug 01, 2002
Posts: 2
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.
 
 
subject: It is very urgent please help…
 
Similar Threads
Login/customer account topic questions
How to add JPA ManyToMany records?
Issue in Inserting data using One to Many
BMP Entity EJBs and create()
Address-has-one-Customer with multiplicity many using foreign-key mapping