How do I set the default schema when configuring A

2019-07-29 22:13发布

问题:

Moving from the following Tomcate Resource Definition:

<Resource name="jdbc/test"
          auth="Container"
          type="javax.sql.DataSource"
          username="user"
          password="pwd"
          driverClassName="com.ibm.as400.access.AS400JDBCDriver"
          url="JDBC:AS400://1.2.3.4:50000/TEST;prompt=false" />

to JTA (Atomikos), I'm wondering how to set the default schema:

<Resource name="jdbc/test"
          auth="Container"
          type="com.atomikos.jdbc.AtomikosDataSourceBean"
          factory="com.atomikos.tomcat.BeanFactory"
          uniqueResourceName="jdbc/test"
          xaDataSourceClassName="com.ibm.as400.access.AS400JDBCXADataSource"
          xaProperties.user="user"
          xaProperties.password="pwd"
          xaProperties.serverName="1.2.3.4"
          xaProperties.prompt="false" />

What's the correct property? I think it's the same question for Spring.

回答1:

In AS400 database schema is determined by "libraries" connection property, in the url. By default, it uses schema named like current username. So in your case, it should probably be something like: xaProperties.libraries="myschema"