aspose file tools*
The moose likes JBoss/WildFly and the fly likes Configuring Oracle 11 G Datasource to use a default schema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Configuring Oracle 11 G Datasource to use a default schema" Watch "Configuring Oracle 11 G Datasource to use a default schema" New topic
Author

Configuring Oracle 11 G Datasource to use a default schema

vikram hegde
Greenhorn

Joined: Sep 07, 2005
Posts: 18
How can I configure the datasource in oracle-ds.xml to also include the database schema name?

If this is possible or not via DB URL or any other configuration?

I am using Spring JDBC which access the JBoss 5.0.1 AS configured DataSource to get DB Connection to connect and execute operations on DB.

Please not the user name is not the same as the schema name that we are using in our organisation. So I cant replace the user name with the schema name.

Please share this info if any have solution for this type of situation. Thank you very much in advance.

Regards'
Vikram
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5837
    
    7

Look in the documentation for the Oracle JDC driver, that should tell you the URL that you need to identify the schema. Then use that URL in your *-ds.xml file.


JBoss In Action
vikram hegde
Greenhorn

Joined: Sep 07, 2005
Posts: 18
Thank you Peter for the reply. I actually looked into Oracle documentations before posting this query in the forum. I didn't find any satisfied solution except, I saw people updating CURRENT_SESSION value at DB level which I felt is not what I was looking at. In Weblogic, I remember we can set default.schema, so I thought even JBoss AS might have such. Anyway, will wait for some more thought. Even open for the DB URL solution. But, I'm not sure if Oracle has such DB URL with default schema name as DB2 has.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5837
    
    7

According to the driver docs at http://docs.oracle.com/cd/B15904_01/web.1012/b14012/datasrc.htm, you need to specify the schema attribute in the URL.

(You never said which Oracle driver you are using, there are many, so I hope the specific docs I referenced are appropriate for you)
vikram hegde
Greenhorn

Joined: Sep 07, 2005
Posts: 18
Thanks a lot Peter, this link helped a lot and I'll go through it in detail. I think I might need to look in detail about that schema="database-schemas/oracle.xml" attribute and not sure will the JBoss AS will understand if I place this as part of *-ds.xml. As far my understanding on the link you gave, its about configurations in Oracle Application Server and might not fit with JBoss AS. But, still thanks for the info as INFORMATION is always valuable and will be helpful somewhere sometime :-)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5837
    
    7

That information is about Oracle's JDBC driver. From what I recall about Oracle URLs (it has been a while since I used Oracle), you can append attributes to the URL, and that is what you need to do. Or you can use a connection property in the *-ds.xml file, example:



See the jboss_home/docs/dtd/jboss-ds.dtd file for details.
vikram hegde
Greenhorn

Joined: Sep 07, 2005
Posts: 18
Thank you so much Peter, for the consistent help that you are lending to me. I actually checked in the jboss-ds_5_0.dtd under docs folder and understood that connection-property tag exists as to pass name/value pair for the connection string. That's an amazing info to know, thanks for sharing it. Also, I Googled and saw few blogs in drools and other technologies using "schema" as one of the name in URL to pass schema name as Oracle connection string property. I'll definitely try in my project tomorrow and will confirm about this. Thanks again for the info, It helps many who ever visit this thread.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Configuring Oracle 11 G Datasource to use a default schema