File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Using JSP how  du I work with jdbc (ms-access) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Using JSP how  du I work with jdbc (ms-access)" Watch "Using JSP how  du I work with jdbc (ms-access)" New topic

Using JSP how du I work with jdbc (ms-access)

shekar narayan

Joined: Mar 14, 2001
Posts: 3
Hi Guys,
I have 4 tables, viz. problem, area, engineer and complaints. While storing the data in the table of complaints, the respective ids of former three are stored. While displayng the records of complaints, i am able to get the ids of the former tables viz. problem, area and engineer and not the names. The other fiels are displayed, fine.
My problem is how do I run a SQL query, such a way that I get the names of the above mentioned tables.
The tables are as follows:
1)probelm : probid, name.
2)area : areaid, name.
3)engineer: engid, engineer.
4)complaints: compid,custname,date,time,problem,area,engineer,status.
Pls help me !

Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252

Is this what you meant? A join? Note: "problemname" and "areaname" are field aliases for your result set, because both fields originally have the same name "name".
A few comments though. Two fundamentally different types of things should, if at all possible, not have the same name. So, "" and "" are fine, they refer to a similar things in different tables. But "" and "" are very different! The first is a name, the second is an id field. Try to adopt a naming convention for your id fields and others instead. For example:

  • problem: id, name
  • area: id, name
  • engineer: id, name
  • complaints: id, problemid, areaid, engineerid,...

  • Some people don't like things like "id" and "name" in tables, and would want you to use "problem_id" and "problem_name". That's fine too. As long as you're consistent.
    Furthermore, watch out with names like "date", "time", and perhaps also "status". In some databases they are reserved words, and to prevent problems you would always have to quote these field names (which leads you straight into the snake pit of case sensitivity if you don't watch out). Rather avoid them if you can.
    - Peter
I agree. Here's the link:
subject: Using JSP how du I work with jdbc (ms-access)
It's not a secret anymore!