Forum Stats

  • 3,770,761 Users
  • 2,253,163 Discussions
  • 7,875,579 Comments

Discussions

How to programatically change schema name for an application ? JDev10g

583757
583757 Member Posts: 34
edited Oct 17, 2008 2:58AM in JDeveloper and ADF
I am using JDeveloper 10g 10.1.3.4
What I am trying to do is: while connecting to the database instace with login/passwd credentials for a specific schema, being able to take in
schema as a separate paramter and connect to that schema.
Connecting to a database instace ORCL to the hr schema say with hr/hr
supply a paramter schema_name: scott. and connect to the scott schema as the hr schema user.

In SQL Plus* all you do is
connect as hr/hr
and then
alter session set current_schema = scott.

While developing an application that autheticates against database username/pwd credentials I was using the methodology
as described on http://www.oracle.com/technology/products/jdev/howtos/10g/dynamicjdbchowto.html
and http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.htmlexample 14.*[Dynamic JDBC Credentials for Model 1 and Model 2|http://otn.oracle.com/products/jdev/tips/muench/dynamiccredentials/DynamicCredentials1013.zip]* [10.1.3.3] 2006, Upd: 17-MAY-2007 by Steve Muench

In the DynamicJDBCBindingFilter that in the doFilter() method, I was trying to find a way to be able to specify the schema name
as in sessoion.setAttribute(Configuration.<SomeProperty>, schema);
is there any property/parameter that can be set to change the schema within the context of the application?
because in all the code that i see there are attributes of 'Configuration' that are being set.
So I don't think there is way for me to just write straight up jdbc code to
create a connection and run the statement "alter session set current_schema = scott"
and be able to pass the login credentials
and connect to the schema I want to.
Any help would be appreciated.

Answers

  • Frank Nimphius-Oracle
    Frank Nimphius-Oracle Member Posts: 29,689 Bronze Badge
    Hi,

    I am not sure if JDBC really supports this. I found

    386043

    but this never got a success/failure statement.

    If you want to use a singe connection but different schema for users then you may want to have a look at proxy user authentication, which is exatly doing what you want - use a single user to get into the database and then have him mapped to his own schema to work in

    Frank
This discussion has been closed.