1.15.2 *Problem with SQLite, it does not connect*

Discussion in 'Spigot Plugin Development' started by Obsidi4nPvP, Feb 15, 2020.

  1. Hi, as the title suggests I have a problem with sqlite. In practice when I try to open the connection it is not opened and it gives me an error message. I have already tried, as I have read in other discussions, to add libraries such as the one available on the official website (mysql-connector-java-8.0.19) but the same problem continues. Stacktrace
    java.sql.SQLException: No suitable driver found for jbdc:sqlite:C:\Users\ObsidianPvP\Desktop\Server\plugins\Obsidian\storage.db
    [10:59:56 WARN]: at java.sql.DriverManager.getConnection(Unknown Source)
    [10:59:56 WARN]: at java.sql.DriverManager.getConnection(Unknown Source)
    [10:59:56 WARN]: at www.obsidianpvp.eu.Database.<init>(Database.java:17)
    [10:59:56 WARN]: at www.obsidianpvp.eu.Obsidian.onEnable(Obsidian.java:47)
    [10:59:56 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321)
    [10:59:56 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340)
    [10:59:56 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405)
    [10:59:56 WARN]: at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357)
    [10:59:56 WARN]: at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317)
    [10:59:56 WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414)
    [10:59:56 WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378)
    [10:59:56 WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333)
    [10:59:56 WARN]: at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263)
    [10:59:56 WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525)
    [10:59:56 WARN]: at java.lang.Thread.run(Unknown Source)
     
  2. SteelPhoenix

    Moderator

    What driver are you trying to use?
     
  3. Are you trying to use MySQL driver for SQLite?!
    Anyway, you have to Class.forName the suitable (SQLite) driver before trying to use it.
     
  4. Now i change the order of code strings and it send a new error: java.sql.SQLException: invalid database address + "my path"
     
    #5 Obsidi4nPvP, Feb 15, 2020
    Last edited: Feb 15, 2020
  5. it needs to be something like this: ("jdbc:sqlite:" + new File(folder, "database.db")
     
    • Optimistic Optimistic x 1
  6. Ok, now is something like this,
    Code (Java):
                this.connection = DriverManager.getConnection("jbdc:sqlite:" + new File(file));
    but don't work and i get the same error
     
  7. I’m having issues with sql right now too :/
     
  8. that's not much to go on, what exactly?
     
  9. Can we get a sample of code to see where you are going wrong?
     
  10. SteelPhoenix

    Moderator

    He doesn't know to connect to the sqlite db. I linked a tutorial showing exactly what addresses are possible:
     
  11. The File needs the directors made also if the database.db is made as a folder you will face the same errors