如何在tomcat的app上下文中设置默认的db模式

时间:2012-05-25 06:32:22

标签: tomcat db2

这是tomcat的localhost文件夹中的我的NXYTEST.xml

<Context path="/test" reloadable="true" docBase="D:\Development\workspace\NXYTEST\WebContent" workDir="D:\Development\workspace\NXYTEST\work">
    <Resource auth="Container" driverClassName="com.ibm.db2.jcc.DB2Driver" maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/ebank_ds" password="abc123" type="javax.sql.DataSource" url="jdbc:db2://172.31.17.114:60012/TESTDB" username="con2nns" />
</Context>

我的项目启动并获得数据库连接,但是出现如下错误:

DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: CON2NNS.PUB_APPPAR caused by: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: CON2NNS.PUB_APPPAR cause: com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: CON2NNS.PUB_APPPAR

我想将“testschema”设置为默认架构,请帮助我,谢谢......

1 个答案:

答案 0 :(得分:5)

您应该可以添加到url=此字符串的末尾:

:currentSchema=MySchema;

所以,你的结果看起来像是:

jdbc:db2://172.31.17.114:60012/TESTDB:currentSchema=testschema;