gpt4 book ai didi

java - 'CREATE TABLE' 数据库中的多语句事务中不允许使用 'tempdb' 命令

转载 作者:行者123 更新时间:2023-12-02 01:21:02 25 4
gpt4 key购买 nike

我正在开发java项目,其中我使用Sybase和Apache Metamodel来获取表数据及其信息。现在“ddl in tran”选项是正确的,但是当我使用 Apache Metamodel 获取列详细信息时,仍然出现错误:

com.sybase.jdbc4.jdbc.SybSQLException: The 'CREATE TABLE' command is not allowed within a multi-statement transaction in the 'tempdb' database.

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

最佳答案

临时数据库中的“ddl in tran”选项也需要处于“on”状态。系统管理员或具有 sa_role 的人员可以执行此操作:

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>

关于java - 'CREATE TABLE' 数据库中的多语句事务中不允许使用 'tempdb' 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57675379/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com