IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Java Discussion :

Chargement du driver


Sujet :

Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Homme Profil pro
    Etudiant du Genie Logiciel
    Inscrit en
    Juillet 2011
    Messages
    397
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Etudiant du Genie Logiciel
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2011
    Messages : 397
    Par défaut Chargement du driver
    salut a vous. depuis deux jours , j'essaie de me connecter a un cube sur sql server 2008 via le Script ci-dessous :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
     
     
     
     
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package com.sobi.test;
     
    import com.sobi.Exception.SobiConfigurationException;
    import com.sobi.database.SobiFactory;
    import java.io.IOException;
    import java.io.InputStream;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.util.Properties;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import org.olap4j.OlapConnection;
    import org.olap4j.OlapWrapper;
     
    /**
     *
     * @author Bezalel
     */
    public class Test {
     private static final String FICHIER_PROPERTIES = "com/sobi/dao/Sobi.properties";
        private static final String PROPERTY_URL = "url";
        private static final String PROPERTY_DRIVER = "driver";
        private static final String PROPERTY_NOM_UTILISATEUR = "nomutilisateur";
        private static final String PROPERTY_MOT_DE_PASSE = "motdepasse";
        private String url;
        private String username;
        private String password;
        /**
         * @param args the command line arguments
         * @throws java.sql.SQLException
         */
        public static void main(String[] args) throws SQLException {
          getInstance() ;
        }
     
     
      public static void getInstance() throws SobiConfigurationException {
            Properties properties = new Properties();
            String url;
            String driver;
            String nomUtilisateur;
            String motDePasse;
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            InputStream fichierProperties = classLoader.getResourceAsStream(FICHIER_PROPERTIES);
            if (fichierProperties == null) {
                throw new SobiConfigurationException("Le fichier properties " + FICHIER_PROPERTIES + " est introuvable.");
            }
            try {
                System.out.println("LOAD FILE");
                properties.load(fichierProperties);
                System.out.println("LOAD FILE OK");
                url = properties.getProperty(PROPERTY_URL);
                driver = properties.getProperty(PROPERTY_DRIVER);
                nomUtilisateur = properties.getProperty(PROPERTY_NOM_UTILISATEUR);
                motDePasse = properties.getProperty(PROPERTY_MOT_DE_PASSE);
     
                System.out.println(url);
                System.out.println(driver);
                System.out.println(nomUtilisateur);
                System.out.println(motDePasse);
            } catch (IOException e) {
                throw new SobiConfigurationException("Impossible de charger le fichier properties " + FICHIER_PROPERTIES, e);
            }
            try {
                Class.forName(driver);
                System.out.println("SUCCESS LOAD DRIVER");
            } catch (ClassNotFoundException e) {
                throw new SobiConfigurationException("Le driver est introuvable dans le classpath.", e);
            }
     
        }   
     
     
     
     
     
          }

    mais a chaque fois j'ai l'erreur ci-dessous

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
     
     
    run:
    LOAD FILE
    LOAD FILE OK
    "jdbc:xmla:Server=http://WINSERVER/xmla/msxisapi.dll"
    "org.jdbc4olap.jdbc.OlapDriver"
    sa
    bezalel
    Exception in thread "main" com.sobi.Exception.SobiConfigurationException: Le driver est introuvable dans le classpath.
    	at com.sobi.test.Test.getInstance(Test.java:74)
    	at com.sobi.test.Test.main(Test.java:39)
    Caused by: java.lang.ClassNotFoundException: "org.jdbc4olap.jdbc.OlapDriver"
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:260)
    	at com.sobi.test.Test.getInstance(Test.java:71)
    	... 1 more
    Java Result: 1
    BUILD SUCCESSFUL (total time: 2 seconds)

    Que faire pour remédier a la situation ?

  2. #2
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Exception in thread "main" com.sobi.Exception.SobiConfigurationException: Le driver est introuvable dans le classpath.
    Première question, où as-tu mis le driver?

  3. #3
    Membre éclairé
    Homme Profil pro
    Etudiant du Genie Logiciel
    Inscrit en
    Juillet 2011
    Messages
    397
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Etudiant du Genie Logiciel
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2011
    Messages : 397
    Par défaut CHARGEMENT DU DRIVER
    J'ai mis le driver dans un fichier Properties

  4. #4
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    Le driver étant typiquement un fichier jar, j'ai du mal à croire que tu as mis le driver dans le fichier properties. Tout ce que tu as pu mettre dans le fichier properties c'est le nom du drover à utiliser, mais ça ne te dispense pas de mettre concrètement le driver dans ton application, c'est à dire de le télécharger chez son vendeur / fournisseur, et de le placer dans le classpath de ton application.

  5. #5
    Membre éclairé
    Homme Profil pro
    Etudiant du Genie Logiciel
    Inscrit en
    Juillet 2011
    Messages
    397
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Etudiant du Genie Logiciel
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2011
    Messages : 397
    Par défaut CHARGEMENT DU DRIVER
    salut a vous. dans mon fichier porperties, je chargeais le driver comme ceci "org.jdbc4olap.jdbc.OlapDriver" au lieu de org.jdbc4olap.jdbc.OlapDriver. en tout cas , c'est ainsi que j'ai résolu mon problème

  6. #6
    Modérateur
    Avatar de wax78
    Homme Profil pro
    R&D - Palefrenier programmeur
    Inscrit en
    Août 2006
    Messages
    4 096
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : R&D - Palefrenier programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 4 096
    Par défaut
    Donc tu peux passer en Résolu avec le bouton en bas de la discutions
    (Les "ça ne marche pas", même écrits sans faute(s), vous porteront discrédit ad vitam æternam et malheur pendant 7 ans)

    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Chargement du driver
    Par david71 dans le forum JDBC
    Réponses: 3
    Dernier message: 10/05/2007, 15h03
  2. [Firebird]Pb de chargement du Driver
    Par bassim dans le forum JDBC
    Réponses: 3
    Dernier message: 26/10/2006, 14h09
  3. Réponses: 2
    Dernier message: 21/10/2006, 15h20
  4. Probleme lors du chargement du driver
    Par Zanton dans le forum JDBC
    Réponses: 2
    Dernier message: 12/10/2006, 14h02
  5. Chargement des drivers access via ODBC sous Qt 3
    Par Higestromm dans le forum Bases de données
    Réponses: 10
    Dernier message: 09/01/2006, 14h30

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo