Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: newbie: query a table from java
Haven't got any answers on this yet? Your problem is scott doesn't have
select privilege on hr.jobs. You need to log in as hr and run this,
SQL> grant select on jobs to scott;
then your query should work.
frank_ratzlow_at_hotmail.com (Frank Ratzlow) wrote in message news:<5ef29569.0302241639.dfb42a6_at_posting.google.com>...
> Hi,
>
> one basically simple thing. I'd like to work with the example tables
> given provided with the standard setup within a java prog.
>
> When issuing the example from a book:
> ======================================
> Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@sunsrv01:1521:fr1",
> "scott", "tiger");
> Statement stmt = conn.createStatement();
> ResultSet rset = stmt.executeQuery("SELECT ename FROM emp");
> ======================================
>
> I get a proper result but when I want to query the table "HR"."JOBS"
> ResultSet rset = stmt.executeQuery("SELECT * FROM hr.jobs");
>
> I always receive
>
> <java.sql.SQLException: ORA-00942: table or view does not exist>
>
> How do I have to format the statement to specify the schema it belongs
> to? At the first glance it seemed to be "HR"."JOBS" but even this with
> and without quoting didn't solved it.
>
> Would be very grateful to get a hint how to touch tables in different
> schemas from JAVA.
>
> TIA
>
> Frank
> frank_ratzlow_at_nojunk.hotmail.com
Received on Tue Feb 25 2003 - 16:59:37 CST
![]() |
![]() |