mysql数据库连接问题(一个数据库能连,但一个不能连),奇怪!!!1
luojuncsu
2009-03-20
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'mylog'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:910) at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3923) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1273) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2031) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at cn.com.common.ConectMysql.getConn(ConectMysql.java:16) at cn.com.dao.UsersFlowDao.testTbale(UsersFlowDao.java:56) at cn.com.dao.Test.main(Test.java:13) conection is wrong Exception in thread "main" java.lang.NullPointerException at cn.com.dao.UsersFlowDao.testTbale(UsersFlowDao.java:60) at cn.com.dao.Test.main(Test.java:13) mylog是一个数据库,这里居然说unknown的数据库,而我连另外一个数据库是没点问题啊,不知道是什么原因? |
|
laowan
2009-03-21
你用什么方式连接的数据库啊?
Exception in thread "main" java.lang.NullPointerException at cn.com.dao.UsersFlowDao.testTbale(UsersFlowDao.java:60) at cn.com.dao.Test.main(Test.java:13) 我估计是连接数据库的配置文件写错了,检查一下 |
|
luojuncsu
2009-03-21
但是我用同样的方式连接另一个数据库 可以连上啊。
|