一、异常描述
在eclipse中通过mybatis-generator生成dao、mappers及model代码时(步骤参考“通过mybatis-generator-core工具自…”页面),报“java.sql.SQLException: Cannot connect to database (possibly bad driver/URL combination)”异常,错误轨迹如下
java.sql.SQLException: Cannot connect to database (possibly bad driver/URL combination)
at org.mybatis.generator.internal.db.ConnectionFactory.getConnection(ConnectionFactory.java:71)
at org.mybatis.generator.config.Context.getConnection(Context.java:498)
at org.mybatis.generator.config.Context.introspectTables(Context.java:408)
at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:221)
at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:132)
at com.xwood.gen.GeneratorExecuter.generator(GeneratorExecuter.java:24)
at com.xwood.gen.GeneratorExecuter.main(GeneratorExecuter.java:29)
二、解决办法
1.从异常描述信息直接可以看出是generator