Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Accessing db name in java stored procedure
Hi Klaus
One possible way _would_ have been to use java (java.net) to determine the hostname;
String h = InetAddress.getLocalHost().getHostName();
Whilst this works fine running from a regular JVM, from Oracle's JVM it always returns "localhost".
Other methods may have been using UTL_FILE and reading data from outside the database, but if you need to use the DB then as you suggest global_name is as good as any.
KJP
Klaus Micholka wrote:
> I have a production and a test oracle 8.1.7 db. The test db is filled
> by a copy
> of the production db.
> The db contains a stored procedure, which comunicates with another
> programm.
>
> The external program wants to know, which is the sending db.
>
> How can the java stored procedure access some identifing data, like
> hostname,
> db name or sid? I can't work with two different stored procedures
> because the productive is copied to the test.
>
> Is there any other way then establishing a connection to the db (which
> db?)
> and select global_name from golbal_name or select * form V$database; (
> I dont have the rights for the last one).
Received on Mon Dec 02 2002 - 21:39:41 CST