Results 1 to 3 of 3
Thread: ms access jdbc query problem
- 04-28-2008, 05:30 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 19
- Rep Power
- 0
ms access jdbc query problem
Dear Forum,
I'm a complete java newby so please bear with me :/
I'm trying some things out with java and ms access.
I manage to connect to my db, and get data from a table. However I'm running into problems when I need data from 2 related tables.
The following query works fine in access
i get a column not found error when trying to get the data in java usingJava Code:select * from table1 t1, table2 t2
rs is a resultset from the executed query and works fine when i useJava Code:table1id = rs.getInt("t1.Id");
I can't seem to find an example with google of a 2 table queryJava Code:select * from table1
Can anyone point me in the right direction?
Cheers!
f.
- 04-28-2008, 07:32 PM #2
Try to use rs.getMetaData() to see what are the column names. I don't think you will get the column names prefixed with table names. On the other hand "select *" is not such a good idea. It is way better to specify what columns you want exactly and in what order and to specify your own names in case of duplication.
One thing I don't understand is the purpose of your query. I don't know Access but it looks like you are gonna get a cartesian product of all the rows in the two tables. Is this what you want?Daniel @ [www.littletutorials.com]
Language is froth on the surface of thought
- 04-30-2008, 06:55 PM #3
Member
- Join Date
- Apr 2008
- Posts
- 19
- Rep Power
- 0
Similar Threads
-
Jdbc problem
By abhiN in forum JDBCReplies: 1Last Post: 03-21-2008, 05:10 AM -
JDBC select problem
By abhiN in forum JDBCReplies: 0Last Post: 03-12-2008, 08:09 AM -
Problem in Servlet with JDBC
By *New Programer* in forum Java ServletReplies: 2Last Post: 12-20-2007, 09:15 AM -
JDBC problem
By Swamipsn in forum New To JavaReplies: 1Last Post: 08-13-2007, 06:05 PM -
JDBC problem
By peiceonly in forum Threads and SynchronizationReplies: 2Last Post: 08-03-2007, 01:42 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks