合 数据库从Oracle迁移到MySQL后,应用报错“No Dialect mapping for JDBC type: -1”
现象
应用启动报错:No Dialect mapping for JDBC type: -1
原因
数据库由Oracle迁移到MySQL,部分字段由varchar2变为了text字段,但是应用端读取数据就会出现问题,所以会报这个错误。
解决
要么修改应用代码,要么修改数据库字段,从text修改为varchar2.
1 2 3 4 5 | SELECT d.TABLE_NAME, d.COLUMN_NAME, CONCAT('alter table ',TABLE_NAME,' MODIFY COLUMN `', COLUMN_NAME ,'` varchar(1000);') sql1 FROM information_schema.COLUMNS d WHERE TABLE_SCHEMA = 'lhrdb' and d.DATA_TYPE in ('mediumtext','text' ); |
但是,修改字段类型时,可能会报错“ERROR 1118 (42000) at line 931: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs”