[求助]为什么我就得不到数据呢? 大虾请进
环境SYBASE 12.5
hibernate 3.0
JDBC driver jconn2
我写了个SP
内容大概是
create #a()
insert into #a
select * from b
select * from #a
drop #a
在sybase client sp通过编译 运行正常
但用hibernate连接 throw exception
The 'CREATE TABLE' command is not allowed within a multi-statement transaction in the 'tempdb' database.
请帮我看一下 为tempdb设置上ddl in tran数据库选项
回复 #2 hobbylu 的帖子
了解 除了这个呢我用jdbc连没事
但用hibernate 连就抱错 AUTOCOMMIT不同(set chained)
JDBC取得的连接是默认的,autocommit = true,也即set chained off
HIBERNATE中启动了JDBC管理的事务,会set autocommit = false,也即set chained on
可参考:http://www.sybaseclub.org/twiki/bin/view.cgi/ASE/ASEProgrammingFAQ :P 谢谢两位的指导~
回复 #4 flybean 的帖子
按照你的方法 我去看了一下default autocommit value
jdbc true
hibernate false
但是我用setAutoCommit(true)方法来达到jdbc一样的环境
但是throw exception
Stored procedure 'mydb..xxxx_sp' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.
why? how to solve it in Hibernate ? 后来我用了hibernate.properties来设置autocommit = true, 奇怪居然通过了 没抛任何异常
后来改用spring提供得HibernateSupport来impl 没出现上述异常
我就是闹不明白为什么 我在程序中用setAuntoCommit(true)方法来运行 就是通不过呢 为什么要在properties文件里就好用呢
页:
[1]