Java ';创建表';在';tempdb&x27;数据库

Java ';创建表';在';tempdb&x27;数据库,java,sybase-ase15,apache-metamodel,Java,Sybase Ase15,Apache Metamodel,我正在从事java项目,在该项目中,我使用Sybase和Apache元模型来获取表数据及其信息。现在“ddl in tran”选项为true,但当我使用Apache元模型获取列详细信息时,仍然会出现错误: com.sybase.jdbc4.jdbc.SybSQLException:在“tempdb”数据库中的多语句事务中不允许使用“CREATE TABLE”命令 我在Windows 10上安装了Sybase ASE 15.5。临时数据库中的“传输中的ddl”选项也需要“打开”。系统管理员或具有s

我正在从事java项目,在该项目中,我使用Sybase和Apache元模型来获取表数据及其信息。现在“ddl in tran”选项为true,但当我使用Apache元模型获取列详细信息时,仍然会出现错误:

com.sybase.jdbc4.jdbc.SybSQLException:在“tempdb”数据库中的多语句事务中不允许使用“CREATE TABLE”命令

我在Windows 10上安装了Sybase ASE 15.5。

临时数据库中的“传输中的ddl”选项也需要“打开”。系统管理员或具有sa_角色的人员可以执行以下操作:

1> use master
2> go
1> sp_dboption tempdb, 'ddl in tran', 'true'
2> go
Warning: Attempting to change database options for a temporary database. Database options must be kept consistent across all temporary databases.
Database option 'ddl in tran' turned ON for database 'tempdb'.
Running CHECKPOINT on database 'tempdb' for option 'ddl in tran' to take effect.
(return status = 0)
正如警告所指出的,如果您有多个临时数据库,则需要在所有临时数据库中保持一致。命令完成后,可使用sp_helpdb检查选项:

1> sp_helpdb
2> go

[stuff deleted]

 tempdb                            104.0 MB              sa             2      Aug 05, 2019             no_recovery                     0               NULL        
 select into/bulkcopy/pllsort, trunc log on chkpt, ddl in tran, mixed log and data, allow wide dol rows 
下面是在事务内创建表的示例:

1> use tempdb
2> go
1> begin tran
2> go
1> create table foo ( k int not null, value varchar(25) null) 
2> go
1> commit
2> go
1> 
临时数据库中的“ddl in tran”选项也需要“打开”。系统管理员或具有sa_角色的人员可以执行以下操作:

1> use master
2> go
1> sp_dboption tempdb, 'ddl in tran', 'true'
2> go
Warning: Attempting to change database options for a temporary database. Database options must be kept consistent across all temporary databases.
Database option 'ddl in tran' turned ON for database 'tempdb'.
Running CHECKPOINT on database 'tempdb' for option 'ddl in tran' to take effect.
(return status = 0)
正如警告所指出的,如果您有多个临时数据库,则需要在所有临时数据库中保持一致。命令完成后,可使用sp_helpdb检查选项:

1> sp_helpdb
2> go

[stuff deleted]

 tempdb                            104.0 MB              sa             2      Aug 05, 2019             no_recovery                     0               NULL        
 select into/bulkcopy/pllsort, trunc log on chkpt, ddl in tran, mixed log and data, allow wide dol rows 
下面是在事务内创建表的示例:

1> use tempdb
2> go
1> begin tran
2> go
1> create table foo ( k int not null, value varchar(25) null) 
2> go
1> commit
2> go
1> 
这可以使用(sp_dboption tempdb,'ddl in tran','true'),但将其设置为true并不是一种好的做法,它可能会导致tempdb中出现并发问题

必须小心使用该选项。

可以使用该选项(sp_dboption tempdb,'ddl in tran','true'),但将其设置为true不是一种好的做法,它可能会导致tempdb中出现并发问题

使用该选项时必须小心