SQLite drivers for bukkit (1.6.2-R0.1)

Discussion in 'Plugin Development' started by 1Rogue, Jul 25, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    1Rogue

    Hi there,


    I seem to be having trouble finding out calling the SQLite drivers for bukkit. I haven't used SQLite in the past, but I have used MySQL. At any rate, it seems that upon running an instantiated sqlite connection, it can't find the proper drivers for it.

    Code:java
    1. public class SQLite {
    2.  
    3. Connection con = null;
    4.  
    5. public Connection open() throws SQLException {
    6. con = DriverManager.getConnection("jdbc:sqlite:" + Playtime.getPlugin().getDataFolder() + File.separator + "users.db");
    7. return con;
    8. }
    9.  
    10. ....
    11.  
    12. }



    Error:
    Code:
    2013-07-25 17:39:10 [SEVERE] null
    java.sql.SQLException: No suitable driver found for jdbc:sqlite:plugins\Playtime\users.db
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at com.rogue.playtime.data.sqlite.SQLite.open(SQLite.java:39)
    at com.rogue.playtime.data.sqlite.Data_SQLite.verifyFormat(Data_SQLite.java:94)
    at com.rogue.playtime.data.DataManager.start(DataManager.java:52)
    at com.rogue.playtime.Playtime.onEnable(Playtime.java:126)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugin(CraftServer.java:282)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.enablePlugins(CraftServer.java:264)
    at net.minecraft.server.v1_6_R2.MinecraftServer.l(MinecraftServer.java:313)
    at net.minecraft.server.v1_6_R2.MinecraftServer.f(MinecraftServer.java:290)
    at net.minecraft.server.v1_6_R2.MinecraftServer.a(MinecraftServer.java:250)
    at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.java:151)
    at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:391)
    at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
    
    Is there some other piece I'm missing here for opening an SQLite connection?

    And a bump for this.

    I also referenced this, saying that the drivers are installed into bukkit, but it still cannot seem to find them:

    https://forums.bukkit.org/threads/bukkit-mysql-sqlite-driver.59103/



    EDIT: It seems I needed to call the driver manually before calling the connection:

    Code:java
    1. try {
    2. Class.forName("org.sqlite.JDBC");
    3. } catch (ClassNotFoundException ex) {
    4. Logger.getLogger(SQLite.class.getName()).log(Level.SEVERE, "Error loading sqlite connection, disabling!", ex);
    5. Bukkit.getServer().getPluginManager().disablePlugin(Playtime.getPlugin());
    6. }


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
Thread Status:
Not open for further replies.

Share This Page