Connect from perl directly to a schema [message #464419] |
Thu, 08 July 2010 01:20 |
chris0101
Messages: 3 Registered: July 2010
|
Junior Member |
|
|
Hi there,
first I want to mention, that I googled for the answer of my question, but I was not successful. So if the answer is very simple, I think I searched for the wrong thing...
I am using DBI to connect to an oracle db, and it is working fine.
But in every statement I have to put my schema in front of the table name.
e.g.:
SELECT row1, row2 FROM schema.table
which is very annoying, as I never change the schema.
While surfing in the internet, I always find statments which are looking like, that perl is directly connected to a certain schema.
I was wondering (if it is possible at all), if I have to change the Oracle listener.ora, tnsnames.ora or the per connection string?
I am using the following:
Perl:
my $db = DBI->connect( "DBI:Oracle:orcl", "user", "pass" );
tnsnames.ora:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
(CONNECT_DATA =
(SID = PLSExtProc)
(SERVICE_NAME = orcl)
)
)
Maybe somebody can help me out?
Thanks and regards,
Chris
|
|
|
|
|
Re: Connect from perl directly to a schema [message #476372 is a reply to message #464448] |
Wed, 22 September 2010 18:47 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
there are 2 other options you can investigate.
The DBA can create a logon trigger for your user, to set the default schema to the table owner.
CREATE OR REPLACE TRIGGER FRED.CHANGE2SCOTT_SCHEMA
AFTER LOGON ON FRED.SCHEMA
begin
execute immediate 'alter session set current_schema = SCOTT';
end;
/
You can also try executing the alter session yourself when you connect. That should set the default scehma for the rest of that session.
|
|
|
|