如何使用Hibernate / JDBC设置DB2的当前架构? [英] How can I set the current schema for DB2 using Hibernate/JDBC?
问题描述
更新:它一定是驱动程序版本问题。我升级到后来的驱动程序,并且currentSchema工作。
9.7(最新)db的所有属性都在这里...
使用:
currentSchema
指定用于在动态准备的SQL语句中限定不合格数据库对象的默认模式名称。该属性的值设置数据库服务器上的CURRENT SCHEMA特殊寄存器中的值。模式名称区分大小写,并且必须以大写字符指定。
I used to use currentSchema=MYSCHEMA; in my JDBC URL connection, but the version of DB2 we're using no longer supports that, showing the error 'The "currentSchema" property is not allowed on the target server'. I've tried using hibernate.default_schema, but it's not automatically adding the schema to my table names. I don't want to set the schema on every @Table annotation since I'll need to change it between test and production. Is there another way to set on the connection or via Hibernate?
Update: it must have been a driver version issue. I upgraded to later drivers and currentSchema worked.
All the properties for the 9.7 (Latest) db are here...
use:
currentSchema
Specifies the default schema name that is used to qualify unqualified database objects in dynamically prepared SQL statements. The value of this property sets the value in the CURRENT SCHEMA special register on the database server. The schema name is case-sensitive, and must be specified in uppercase characters.
这篇关于如何使用Hibernate / JDBC设置DB2的当前架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!