aspose file tools
The moose likes JDBC and the fly likes Getting data from mutiple tables Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Getting data from mutiple tables" Watch "Getting data from mutiple tables" New topic
Author

Getting data from mutiple tables

adithi shashishekar
Greenhorn

Joined: Aug 01, 2008
Posts: 1
I am converting a servlet based application to struts framework.I have a screen which gets data from 7 tables.I cannot use a stored procedure so has to manage using SQL queries.I thought i will query each table and set it to my struts form.The screen has lot of drop down boxes .

Please let me know the best way to query the tables.Here are the queries.



Select a.proj_id , a.proj_nm
From stn_proj_et a, stn_proj b
Where a.proj_id = b.proj_id
And a.sftwr_id = 24
And b.stn_id = bst_id

Select round(utm_x,3) utm_x, round(utm_y,3) utm_y, stn_id
From stn_loc_hist
Where stn_id =bst_id
And cur_use_cd = 1

select data_tp_cd
from data_coll_summ
where stn_id =bst_id
And rownum < 2;

select lat_no,long_no,pnt_loc_dsc,srce_id,mthd_dtrmn_cd,ctrl_dtm_cd
from stn_et
where stn_id = bst_id
select
distinct sjr_utils.getcatalogvalue(mthd_dtrmn_cd)
from stn_et;

select
distinct sjr_utils.getcatalogvalue(ctrl_dtm_cd)
from stn_et;

select distinct PROJ_NM from stn_proj_et where sftwr_id=24;

Select a.stn_alias_nm stn_alias_nm, b.alias_orgn_nm alias_orgn_nm
From stn_alias_nm a, alias_orgn_et b
Where a.alias_orgn_id = b.alias_orgn_id
And b.alias_orgn_tp = 0
And stn_id = bst_id;
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56205
    
  13

If your application's database code must be rewritten to adopt Struts in place of raw servlets, I'd contend that your app is very badly structured. The Model and persistence code should be completely independent of the UI code.

If you are refactoring the app, now is the time to get into an accepted best-practice structure.
[ August 01, 2008: Message edited by: Bear Bibeault ]

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
arun nohwar
Greenhorn

Joined: Aug 05, 2008
Posts: 16
Use PooledConnection and ConnectionPoolDataSource.

1. If you use 1 pooled connection then all your 7(no of your tables) database requests are sequential.

2. If you use 7 pooled connection objects, then it is database access time hit.

Any java oriented solution is not better than database stored procedure/database object solution.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting data from mutiple tables
 
Similar Threads
HFE Page 428 - Q12 : EJB-QL (one to many relationship)
delete duplicate rows
EJB QL query from a mock exam
Executing one resultset inside another
looping in oracle or java