views:

116

answers:

1

Hi,

I have an account in oracle database. I can connect it via jdbc in my java code.

When I access database from Oracle SQL Developer, under "Connections"->"Other Users", I can access to their tables (I have been assigned privilege for reading others tables).

My question is, how to access / retrieve data from others tables via jdbc?

+3  A: 

You need to prefix the table name with the schema name, which in Oracle is the same as the user name.

select * from some_other_user.their_table;

If having the user name hardcoded in the SQL statement is a problem, you could make that configurable on the Java side somehow or install a table alias (synonym) into your own schema on the Oracle side.

Thilo
thanks, it works.
janetsmith