fatjar打包mysql_myeclipse打包java项目,mysql数据库怎么打包进去?

怎么把数据库打包进去,我用fatjar打包之后,数据库的驱动包是打包进去了的,然后我生成了exe。在我自己的电脑上可以运行,没有问题,可是传给另一台电脑之后,就无法连接数据库了,数…

怎么把数据库打包进去,我用fatjar打包之后,数据库的驱动包是打包进去了的,然后我生成了exe。在我自己的电脑上可以运行,没有问题,可是传给另一台电脑之后,就无法连接数据库了,数据无法显示。具体的log是这样的:JarClassLoader: Warning: Unable to load native library: java.lang.NullPointerException

java.sql.SQLException: Access denied for user ‘root’@’localhost’ (using password: YES)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:943)

at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4113)

at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1308)

at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2336)

at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)

at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:792)

at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47)

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:411)

at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)

at java.sql.DriverManager.getConnection(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at frame.NewSWTApp.button1MouseDown(NewSWTApp.java:329)

at frame.NewSWTApp.access$4(NewSWTApp.java:325)

at frame.NewSWTApp$5.mouseDown(NewSWTApp.java:283)

at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)

at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)

at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)

at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)

at frame.NewSWTApp.main(NewSWTApp.java:320)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.simontuffs.onejar.Boot.run(Boot.java:306)

at com.simontuffs.onejar.Boot.main(Boot.java:159)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

……

展开

    原文作者:星火英语
    原文地址: https://blog.csdn.net/weixin_29423089/article/details/113343647
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞