当前使用版本(必须填写清楚,否则不予处理)

Finchley.RELEASE 2.1.1 2.3.3 3.0.0 1.1.21

该问题是怎么引起的?(最新版上已修复的会直接close掉)

动态数据源配置 spring: datasource: dynamic: druid: # 连接池的配置信息 # 初始化大小,最小,最大 initialSize: 5 minIdle: 5 maxActive: 20 # 配置获取连接等待超时的时间 maxWait: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 timeBetweenEvictionRunsMillis: 60000 # 配置一个连接在池中最小生存的时间,单位是毫秒 minEvictableIdleTimeMillis: 300000 validationQuery: SELECT 1 FROM DUAL testWhileIdle: true testOnBorrow: false testOnReturn: false # 打开PSCache,并且指定每个连接上PSCache的大小 poolPreparedStatements: false maxPoolPreparedStatementPerConnectionSize: 20 # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 filters: stat,wall # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 aop-patterns: com.fehorizon.tms.service.* datasource: master: url: jdbc:mysql://xxx:3306/tms?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false username: xxx password: xxx driver-class-name: com.mysql.jdbc.Driver slave_1: url: jdbc:mysql://xxx:3306/tms?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false username: xxx password: xxx driver-class-name: com.mysql.jdbc.Driver erp_oracle_1: url: jdbc:oracle:thin:@xxx:1521:hxoradev username: xxx password: xxx driver-class-name: oracle.jdbc.driver.OracleDriver druid: testWhileIdle: true testOnBorrow: true testOnReturn: false poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 50

mybatis-plus: # 如果是放在src/main/java目录下 classpath:/com/yourpackage//mapper/Mapper.xml # 如果是放在resource目录 classpath:/mapper/Mapper.xml mapper-locations: classpath:/mappers//*.xml #实体扫描,多个package用逗号或者分号分隔 typeAliasesPackage: com.fehorizon.tms.entity global-config: #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; id-type: 0 #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" field-strategy: 2 #驼峰下划线转换 db-column-underline: true #mp2.3+ 全局表前缀 mp_ #table-prefix: mp_ #刷新mapper 调试神器 refresh-mapper: true #数据库大写下划线转换 #capital-mode: true #逻辑删除配置(下面3个配置) logic-delete-value: 4 logic-not-delete-value: 0 configuration: #配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId) map-underscore-to-camel-case: true cache-enabled: false #配置JdbcTypeForNull, oracle数据库必须配置 jdbc-type-for-null: 'null'

重现步骤

spring-boot项目,使用动态数据源,配置上面已经贴了, 在执行oracle数据库查询时,生成的sql包含了“ ”的sql语句,SELECT BILLID AS billid,BILLTYPE AS billtype,SEQUENCE AS sequence,`MONTH``

报错信息

上面的sql会报错,oracle不能识别这个符号 ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00911: invalid character

上面的问题是否可用通过什么配置改掉,在跟进初始化过程时,看到初始化globalconfig时,按照jdbcurl判断了dbtype,在执行sql时并没有替换这个dbtype。 public void setDbTypeOfJdbcUrl(String jdbcUrl) { this.dbType = JdbcUtils.getDbType(jdbcUrl); }

Comment From: ClownfishYang

当我接入Oracle 数据源的第二天,也遇到了跟你同样的问题

Comment From: ukihsoroy

接入greenplum,同样出现了不能识别 ````` 这个符号 org.postgresql.util.PSQLException: ERROR: operator does not exist: date 建议:No operator matches the given name and argument type(s). You might need to add explicit type casts. 位置:36

Comment From: qmdx

2x 不在维护,请下载代码自行修改