NutzCN Logo
问答 nutzwk3.0 数据库更改为oracle 初始化无法创建表
发布于 3005天前 作者 qq_0aa4e563 2167 次浏览 复制 上一个帖子 下一个帖子
标签:
db.properties中的配置

#oracle
db.url=jdbc:oracle:thin:@//localhost:1521/orcl
db.username=NutzWk
db.password=pass
db.validationQuery=select 1 from dual
db.maxActive=100

控制台报错日志

2016-08-31 15:59:22,202 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:106) DEBUG - Table 'api_test' doesn't exist!
2016-08-31 15:59:22,220 org.nutz.dao.impl.jdbc.AbstractJdbcExpert.setupEntityField(AbstractJdbcExpert.java:106) DEBUG - Table 'sys_user' doesn't exist!
2016-08-31 15:59:22,237 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:339) DEBUG - CREATE TABLE sys_user(
id VARCHAR2(32) primary key ,
loginname VARCHAR2(120),
password VARCHAR2(100),
salt VARCHAR2(50),
nickname VARCHAR2(100),
online char(1) check (online in(0,1)),
disabled char(1) check (disabled in(0,1)),
email VARCHAR2(255),
loginAt NUMBER(5),
loginIp VARCHAR2(255),
loginCount NUMBER(5),
customMenu VARCHAR2(255),
loginTheme VARCHAR2(100),
loginSidebar char(1) check (loginSidebar in(0,1)),
loginBoxed char(1) check (loginBoxed in(0,1)),
loginScroll char(1) check (loginScroll in(0,1)),
unitid VARCHAR2(32),
opBy VARCHAR2(32),
opAt NUMBER(5),
delFlag char(1) check (delFlag in(0,1)))
2016-08-31 15:59:22,412 org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:89) DEBUG - SQLException
java.sql.SQLSyntaxErrorException: ORA-00904: : 标识符无效

	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
	at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
	at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
	at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:194)
	at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1000)
	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1307)
	at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1882)
	at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1847)
	at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:301)
	at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:416)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:308)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:52)
	at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:187)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:147)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:93)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:77)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:63)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:61)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:267)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:275)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:263)
	at org.nutz.dao.impl.jdbc.oracle.OracleJdbcExpert.createEntity(OracleJdbcExpert.java:132)
	at org.nutz.dao.impl.EntityHolder.reloadEntity(EntityHolder.java:85)
	at org.nutz.dao.impl.NutDao.create(NutDao.java:788)
	at org.nutz.dao.util.Daos.createTablesInPackage(Daos.java:544)
	at cn.wizzer.common.core.Setup.initSysData(Setup.java:135)
	at cn.wizzer.common.core.Setup.init(Setup.java:44)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:424)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1429)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:631)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:568)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:295)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
16 回复

没看出哪个字段名是关键字,到plsql测试一下吧

来自炫酷的 NutzCN

@wendal 数据库里表没有创建成功,库里是没有表的

@qq_0aa4e563 把sql拷贝过去试

来自炫酷的 NutzCN

online 居然是关键字..

@wendal
@ColDefine(type = ColType.INT, width = 5)
mysql里长度是20
在oracle里长度的number(5)
造成时间戳插入失败

@Wizzercn online 关键字 这个怎么解决呢

@qq_0aa4e563 等我完成oracle适配提交

@qq_0aa4e563 改完收工,你从bootstrap 主分支下载看看,没问题了,我就重新发布 3.2.5版本

@Wizzercn 已经可以了, 不过有个小问题不知道影不影响, 就是在创建sequences和triggers 报错了 但是数据库了已经创建成功了 所以不知道影不影响(不知道跟我数据库可有关系 因为工作原因暂时不方便将数据库换成UTF-8 的 所以数据库中依然是乱码存储的数据,数据库是必须要用UTF-8 的编码的吗?)

2016-09-01 09:08:56,822 com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:147) ERROR - merge sql error, dbType oracle, sql : 
CREATE SEQUENCE sys_log_id_SEQ  MINVALUE 1 MAXVALUE 999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE
com.alibaba.druid.sql.parser.ParserException: TODO : LITERAL_INT CACHE
	at com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser.parseStatementList(OracleStatementParser.java:486)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:147)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:142)
	at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:53)
	at com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:145)
	at com.alibaba.druid.filter.stat.StatFilter.createSqlStat(StatFilter.java:630)
	at com.alibaba.druid.filter.stat.StatFilter.internalBeforeStatementExecute(StatFilter.java:397)
	at com.alibaba.druid.filter.stat.StatFilter.statementExecuteBefore(StatFilter.java:345)
	at com.alibaba.druid.filter.FilterEventAdapter.statement_execute(FilterEventAdapter.java:185)
	at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:2487)
	at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.execute(StatementProxyImpl.java:137)
	at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:416)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:308)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:52)
	at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:111)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:147)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:93)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:77)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:63)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:61)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:267)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:275)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:263)
	at org.nutz.dao.impl.jdbc.oracle.OracleJdbcExpert.createEntity(OracleJdbcExpert.java:132)
	at org.nutz.dao.impl.EntityHolder.reloadEntity(EntityHolder.java:85)
	at org.nutz.dao.impl.NutDao.create(NutDao.java:788)
	at org.nutz.dao.util.Daos.createTablesInPackage(Daos.java:544)
	at cn.wizzer.common.core.Setup.initSysData(Setup.java:136)
	at cn.wizzer.common.core.Setup.init(Setup.java:44)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:424)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1429)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:631)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:568)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:295)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

这是druid的sql解析器的bug,不影响使用

来自炫酷的 NutzCN

@wendal 嗯嗯 好的 谢谢 不过 是不是数据库必须要用UTF-8编码

@qq_0aa4e563 n码合一,无烦恼

来自炫酷的 NutzCN

@wendal 啊 啥意思? 就是不一定需要时UTF-8 么

@qq_0aa4e563 必须utf8

来自炫酷的 NutzCN

@wendal 好吧 知道了 谢谢

添加回复
请先登陆
回到顶部