pom 依赖 连的是SQL SERVER 2008 R2
com.alibabadruid1.0.27net.sourceforge.jtdsjtds1.3.1
DruidPlugin () { DruidPlugin(PropKit.().trim()PropKit.().trim()PropKit.().trim()PropKit.().trim())}
从DruidPlugin获取到conn 能使用jdbc 读取到数据,所以连数据库是没问题的,只是下面的 Generator 报错,我觉的应该是设置方言就能解决问题,可是从DruidPlugin里好像是没有设置方言的地方,报错如下。
Build TableMeta ...
三月 11, 2017 11:19:08 上午 com.alibaba.druid.pool.DruidDataSource info
信息: {dataSource-1} inited
Skip table :dtproperties
Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: '`' 附近有语法错误。
at com.jfinal.plugin.activerecord.generator.MetaBuilder.build(MetaBuilder.java:102)
at com.jfinal.plugin.activerecord.generator.Generator.generate(Generator.java:217)
at com.jikeapi.config._JFinalDemoGenerator.main(_JFinalDemoGenerator.java:72)
Caused by: java.sql.SQLException: '`' 附近有语法错误。
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:505)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1427)
at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:140)
at com.jfinal.plugin.activerecord.generator.MetaBuilder.buildColumnMetas(MetaBuilder.java:221)
at com.jfinal.plugin.activerecord.generator.MetaBuilder.build(MetaBuilder.java:97)
... 2 more
Disconnected from the target VM, address: '127.0.0.1:54915', transport: 'socket'
对于 sqlserver 来说,生成的时候可能会碰到一点问题,参考一下这个贴子:http://www.jfinal.com/share/211