org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
问题场景: 在同一个事务中,抛出自定义异常,该异常继承RuntimeExcpetion,且使用try catch无效,持久层使用JPA
select tabname from SYSCAT.TABLES where TABSCHEMA ='当前表空间名称'
select * from SYSCAT.COLUMNS where TABSCHEMA ='当前表空间' and TABNAME = '当前表名称' order by SYSCAT.COLUMNS.COLNO
select tabname,card from syscat.tables where tabschema ='当前表空间' --tabname: 表名 --card: 总行数 --tabschema: 模式、架构
select tablename from pg_tables where schemaname = '当前表空间'
select * from information_schema.columns c where table_schema = '当前表空间' and table_name = '当前表名' order by ordinal_position
select schemaname,relname ,n_live_tup from pg_catalog.pg_stat_user_tables where schemaname = '模式' order by n_live_tup desc; --schemaname: 模式 --relname : 表名称 --n_live_tup : 总行数
--db2查询索引 select * from syscat.indexes where tabname = '表名' -- pgsql查看索引 select * from pg_catalog.pg_indexes where tablename = 'tableName';
DB2数据库版本 ,数据库编码UTF-8环境下:
1个中文字符在表结构中占3个varchar字符,1个字符占一个varchar字符,
1个数据占一个varchar字符,varchar(20)最多可以存放6个中文字符,再加2个字母或数据
1.with 临时表语法支持
2.fetch first 10 rows only 支持
3.探测语句
db2: select 1 from sysibm.sysdummy1
pgsql: select 1
4.时间函数转换
current date 修改为 current_date
hour(a.fb_time) >=8 修改为 extract(hour from a.fb_time) >= 8
5.pgsql 不支持空串,空即null
6.db2截取大字段,dbms_lob.substr(field), pagsql不支持
7.db2中clob类型对应pgsql text类型,blob类型队形bytea类型
8.JPQL中in查询 最好写成 in : param,或者 in(:param), 不加括号保留一个空格