简体   繁体   中英

Change Oracle DB Workspace in datasource Connection JBOSS

Here is the thing... I have the following datasource:

<datasource jndi-name="java:/GPET_JU1@des12gpe1" pool-name="GPET_JU1@des12gpe1" enabled="true" use-java-context="true">
    <connection-url>jdbc:oracle:thin:@//bla:9999/blablabla</connection-url>
    <driver>oracle</driver>
    <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
    <security>
        <user-name>blablabla</user-name>
        <password>blablabla</password>
    </security>
    <pool>
        <min-pool-size>10</min-pool-size>
        <max-pool-size>100</max-pool-size>
        <prefill>true</prefill>
        <allow-multiple-users></allow-multiple-users>
    </pool>
    <validation>
        <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"></exception-sorter>
    </validation>
    <timeout>
        <idle-timeout-minutes>10</idle-timeout-minutes>
    </timeout>
    <statement>
        <prepared-statement-cache-size>0</prepared-statement-cache-size>
        <share-prepared-statements>false</share-prepared-statements>
    </statement>
      **<new-connection-sql>
        Begin execute immediate 'CALL DBMS_WM.GotoWorkspace ("APP_TESTE_01")'; end;
    </new-connection-sql>**
</datasource>

I need to change the workspace from "LIVE" to "X", everytime this datasource is called to create a connection in database. I'm getting:

Caused by: java.sql.SQLException: ORA-06576: not a function or valid method 

If I perform a select instead of trying to change the workspace, I dont get error but obviously it doesn't change the workspace like I wanted.

Any ideas in how I can manage to change the oracle db workspace using the datasource?

Got success by the following:

<new-connection-sql>
    Begin DBMS_WM.GotoWorkspace ('APP_TESTE_01'); end;
</new-connection-sql>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM