Solved

In Java AND SQL, Access a parent table and display the data

Posted on 2004-08-10
2
335 Views
Last Modified: 2008-01-09
How do access AAAA  database table "Board_Cntrl_T",( parent table).
The primary key is an Bd_Id.
The Board_Cntrl_T  table has a numer of fields( only need a few of them).
 A table is "selected" if  the current date time is no earlier than 10 days prior to the c-dt  nor later than 10 days prior to the group’s c-dt. The data I need to display is from three other fields: bd_name, sys_user_id,sys_access_dt.   I would like to display the fields for me to see. This will get me started. Thank you
0
Comment
Question by:coolgem
2 Comments
 
LVL 1

Accepted Solution

by:
jmeree earned 250 total points
ID: 11768024
Create a connection to database AAAA and a statement using your jdbc driver (here is one sample: http://archive.midrange.com/java400-l/200312/msg00165.html).  Create a string with your sql statement in it:

select bd_name, sys_user_id, sys_access_dt
from Board_Cntrl_T X, other_table Y
where Y.Bd_Id = X.Bd_Id   -- joins the parent to the child table
and sys_access_dt > (sysdate-10)   -- sysdate syntax depends on your database
and sys_access_dt > (group_cre_date)

If you want to select tables dynamically, you'll have to do two sql statements.  The first will get the table name from the system catalog (user_tables for oracle) and then select the data from the table in the second select statement.

I hope this helps. You didn't say what database you were using and you didn't give any info on the child tables.
0
 

Author Comment

by:coolgem
ID: 11842847
thank you jmeree
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SPLUNK REST  API call to Splunk to create and index? 2 100
wordcount challenge 11 103
Counting documents in a Domino View 3 62
index Out OF Range Exception error 4 53
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about a problem I had getting the GPS LocationListener working.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now