如何使用SmartFoxServer 2X连接MySQL数据库?

时间:2016-01-27 11:51:18

标签: java mysql database jdbc smartfoxserver

我已经开始使用SmartFoxServer 2x了。我曾经使用SmartFoxServer Pro,但我决定使用HTML5,所以我做到了。无论如何,数据库管理器存在问题。首先,我会告诉你到目前为止我做了什么:

  1. 我从MySQL网站下载了“mysql-connector-java-5.1.38-bin.jar”文件。

  2. 我将其复制到“SmartFoxServer 2X \ SFS2X \ extensions__lib__”文件夹中。

  3. 之后,我输入了管理工具>区域配置器>数据库管理员。

  4. 激活=是

  5. 数据库驱动程序类= com.mysql.jdbc.Driver

  6. 连接字符串= jdbc:mysql:// localhost:3306 / login

  7. 用户名= root

  8. 密码= my_mysql_password

  9. 测试SQL = SELECT * FROM users

  10. 我重新启动了服务器。

  11. 它给了我这个错误:

    Exception: java.lang.ClassNotFoundException
    Message: com.mysql.jdbc.Driver 
    Description: The initialization of the DBManager has failed.
    Possible Causes: if the database driver is not 'seen' int the server classpath the setup fails.
    Make sure to deploy the driver .jar file in the extensions/__lib__/ folder and restart the Server.
    +--- --- ---+
    Stack Trace:
    +--- --- ---+
    java.net.URLClassLoader$1.run(Unknown Source)
    java.net.URLClassLoader$1.run(Unknown Source)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
    sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Unknown Source)
    com.smartfoxserver.v2.db.SFSDBManager.setupDriver(SFSDBManager.java:345)
    com.smartfoxserver.v2.db.SFSDBManager.init(SFSDBManager.java:62)
    com.smartfoxserver.v2.entities.managers.SFSZoneManager.configureDBManager(SFSZoneManager.java:638)
    com.smartfoxserver.v2.entities.managers.SFSZoneManager.createZone(SFSZoneManager.java:406)
    com.smartfoxserver.v2.entities.managers.SFSZoneManager.initializeZones(SFSZoneManager.java:249)
    com.smartfoxserver.v2.SmartFoxServer.start(SmartFoxServer.java:266)
    com.smartfoxserver.v2.Main.main(Main.java:27)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
    com.exe4j.runtime.WinLauncher.main(Unknown Source)
    com.install4j.runtime.launcher.WinLauncher.main(Unknown Source)
    

    我该怎么办?

1 个答案:

答案 0 :(得分:1)

你需要在内部正确放置" mysql-connector-java-5.1.38-bin.jar SmartfoxServer2X / SFS2X / lib文件夹

有关进一步配置,请点击以下链接:[https://www.youtube.com/watch?v=PFSMBRJ4gdU&list=PLAD3A1B608ACA09C0&index=10][1]