SQL join clauses in JSP

We want to make an edit in which users will be able to write SQL queries and show them the result in a table. The problem is that, when doing joins, the fields with the same name in both database tables are misinterpreted, for example:

if we have x.name and y.name as columns of two tables (x and y), when we use getString("name") we lose the string for the second getString.

We have tried too:

getString(rsmd.getTableName(i)+".name") being rsmd a ResultSetMetaData object and i the number of the column. It wasn't successful because getTableName didn't return the table name (as we know, it returns the table name or "" if not applicable).

thanks in advance.

[709 byte] By [EVA_02] at [2007-9-26 3:17:19]
# 1

Is this getString("name") method used over object "Resultset" ?

U can use getString(int) instead and specify the location of the "name" attributes

Example if the SQl looks like

select x.name,y.name,x.abc,x.temp form ... bla bla

x.name is getString(1);

y.name is getString(2);

Hope this helped you

Thanks

Sampath .

Sampathrt at 2007-6-29 11:30:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...