[infinispan-issues] [JBoss JIRA] (ISPN-4229) The JDBC Cache store should not require the schema name configuration

Ingo Maas (JIRA) issues at jboss.org
Tue Feb 17 04:06:49 EST 2015


    [ https://issues.jboss.org/browse/ISPN-4229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040759#comment-13040759 ] 

Ingo Maas commented on ISPN-4229:
---------------------------------

It is very common in production environments to have two distinct users, one to connect to the database and one for table ownership. Usually, the switch between these two users is made by using some "initSql" setting when configuring the datasource. For Oracle, the following SQL does the switch: 
{code}
alter session set current_schema=TABLE_OWNER_SCHEMA
{code}

This setup fails in Infinispan's {{TableManipulation.tableExists()}}. It is wrong to assume that the connect-user retrieved by {{connection.getMetaData().getUserName()}} is equal to current database schema.

Possible ways to get current schema in Oracle are:
* use method {{javax.sql.Connection.getSchema()}}, but: introduced in JDK 7, many JDBC drivers still fail with an AbstractMethodError,
* execute SQL statement {{select sys_context('userenv', 'current_schema') from dual}}, IMHO currently the best way to go.


> The JDBC Cache store should not require the schema name configuration
> ---------------------------------------------------------------------
>
>                 Key: ISPN-4229
>                 URL: https://issues.jboss.org/browse/ISPN-4229
>             Project: Infinispan
>          Issue Type: Feature Request
>            Reporter: Mircea Markus
>




--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the infinispan-issues mailing list