• S'inscrire
    • Se connecter
    • Recherche
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes

    Résolu Connexion à ma base de donné échoué

    1.7.x
    1.7.10
    3
    5
    1091
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • Snyker
      Snyker dernière édition par

      Bonjour, ( je revient àprèèèèèèèèèèès longtemps d’absence rt )

      Je souhaite pouvoir crée une base de donné dans mon mod malheureusement il n’arrive pas à me le crée/charger.

      Code erreur:
      :::

      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/local
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.sql.DriverManager.getConnection(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.sql.DriverManager.getConnection(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.degraduck.minefus.proxy.SQL.connection(SQL.java:25)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.degraduck.minefus.Minefus.preInit(Minefus.java:39)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.post(EventBus.java:275)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.post(EventBus.java:275)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.Minecraft.run(Minecraft.java:931)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.main.Main.main(Main.java:164)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
      [20:31:01] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at GradleStart.main(Unknown Source)
      

      :::

      Code SQL :
      :::

      private Connection connection;
      private String urlbase, host, database, user, pass;
      
      public SQL(String urlbase, String host, String database, String user, String pass){
      this.urlbase = urlbase;
      this.host = host;
      this.database = database;
      this.user = user;
      this.pass = pass;
      }
      
         public Connection connection() {
             if(!this.isConnected()) {
                 try {
                     connection = DriverManager.getConnection(urlbase + host + "/" + database, user, pass);
                     System.out.println("connexion a la BDD reussi");
                 } catch (SQLException var2) {
                     var2.printStackTrace();
                 }
             }
      
             return null;
         }
      
         public Connection deconnection() {
             if(this.isConnected()) {
                 try {
                     this.connection.close();
                     System.out.println("BDD deconnecter");
                 } catch (SQLException var2) {
                     var2.printStackTrace();
                 }
             }
      
             return null;
         }
      
         public boolean isConnected() {
             return this.connection != null;
         }
      

      :::

      Code Main class:
      :::

      public class Minefus {
      
      @Instance("modminefus")
      public static Minefus instance;
      public SQL sql;
      
      @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
      public static CommonProxy proxy;
      
      public static CreativeTabs BlockMinefusCreativeTabs = new BlockMinefusCreativeTabs("blockminefus_creative_tabs");
      
      @EventHandler
      public void preInit(FMLPreInitializationEvent event)
      {
      M_Block.init();
      M_BlockMulti.init();
      this.sql = new SQL("jdbc:mysql://","localhost","local","root","");
      this.sql.connection();
      
      }
      
      @EventHandler
      public void init(FMLInitializationEvent event)
      {
      proxy.registerRender();
      }
      
      @EventHandler
      public void postInit(FMLPostInitializationEvent event)
      {
      
      }
      

      :::

      Aucune signature n'est disponible pour une barre chocolatée.

      1 réponse Dernière réponse Répondre Citer 0
      • robin4002
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

        Salut,
        As-tu ajouté la bibliothèque mysql-connector-java ?

        1 réponse Dernière réponse Répondre Citer 0
        • Snyker
          Snyker dernière édition par

          Heu non je savais même pas qu’il fallait un truc de ce genre O_o
          C’est trouvable sur google?

          Aucune signature n'est disponible pour une barre chocolatée.

          1 réponse Dernière réponse Répondre Citer 0
          • AymericRed
            AymericRed dernière édition par

            Java ne gère pas tout seul la connection aux bdd, il faut une lib qui fait ça, et oui c’est trouvable (https://www.google.fr/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=mysql connector java).

            Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

            AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

            Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
            Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

            1 réponse Dernière réponse Répondre Citer 0
            • Snyker
              Snyker dernière édition par

              [21:55:58] [Client thread/INFO] [STDOUT]: [com.degraduck.minefus.proxy.SQL:connection:26]: connexion a la BDD reussi

              Merci 😄

              Aucune signature n'est disponible pour une barre chocolatée.

              1 réponse Dernière réponse Répondre Citer 0
              • 1 / 1
              • Premier message
                Dernier message
              Design by Woryk
              Contact / Mentions Légales

              MINECRAFT FORGE FRANCE © 2018

              Powered by NodeBB