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

NetBeans Java Discussion :

Connexion à une BDD


Sujet :

NetBeans Java

  1. #1
    Membre émérite Avatar de Cpt Anderson
    Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2005
    Messages
    626
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2005
    Messages : 626
    Points : 2 480
    Points
    2 480
    Par défaut Connexion à une BDD
    Bonjour à tous,

    je suis en train de découvrir NetBeans (5.0), j'ai crée un appli web avec des tutoriaux.

    Je veux executer une requete toute simple. Voici mon code:

    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
    <%
              try
              {        
              Class.forName("net.sourceforge.jtds.jdbc.Driver");
              String url = "jdbc:jtds:sqlserver://s9/TestWeb";
              Connection con = DriverManager.getConnection(url);
              Statement stmt = con.createStatement();
              ResultSet rs = stmt.executeQuery("select * from personnes");
               while(rs.next())
               {
                 out.println(rs.getString("TW_Prenom") + "-" + rs.getString("TW_Name"));
               }
              }
              catch (Exception err)
              {
                  err.printStackTrace();
              }          
            %>
    Comme vous le voyez, c'est d'une simplicité...

    Malheureusement, j'ai une exception à la 3e ligne lorsque la connexion doit etre renseignée.
    Mon url et ma base sont corrects.

    java.io.IOException: SSO Failed: Native SSPI library not loaded...

    J'ai pourtant rajouter ma librairie jtds 1.0.3.jar à mon projet...

    Si quelqu'un pouvait m'aider...merci d'avance...

  2. #2
    Membre expérimenté Avatar de maxf1
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    1 229
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Moselle (Lorraine)

    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 229
    Points : 1 371
    Points
    1 371
    Par défaut
    J'ai pourtant rajouter ma librairie jtds 1.0.3.jar à mon projet...
    T'as rajoutés ton jar au classpath ou au buildpath? (pour info il faut bien le mettre dans le classpath, le buildpath tout depend de ton code, mais inutile dans ton cas)

    Dans ton cas vu que c'est une appli web il faut le rajouter au classpath de ton serveur d'application.

  3. #3
    Expert confirmé
    Avatar de Valère
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 334
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Août 2005
    Messages : 1 334
    Points : 4 740
    Points
    4 740
    Par défaut
    Si tu utilises Tomcat, il faut rajouter le driver dans le common/lib du tomcat.

    par ex pour le bundled tomcat, ~netbeans-5.5\enterprise3\apache-tomcat-5.5.17\common\lib

    Valère

  4. #4
    Membre émérite Avatar de Cpt Anderson
    Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2005
    Messages
    626
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2005
    Messages : 626
    Points : 2 480
    Points
    2 480
    Par défaut
    T'as rajoutés ton jar au classpath ou au buildpath?

    il est dans le classpath.

    Si tu utilises Tomcat, il faut rajouter le driver dans le common/lib du tomcat.

    Ok, je viens de le faire mais j'ai toujours cette p.... d'exception....

  5. #5
    Expert confirmé
    Avatar de Valère
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 334
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Août 2005
    Messages : 1 334
    Points : 4 740
    Points
    4 740
    Par défaut
    Tu as relancé Tomcat?

    Peux tu poster l'exception STP?

    Valère

  6. #6
    Membre émérite Avatar de Cpt Anderson
    Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2005
    Messages
    626
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2005
    Messages : 626
    Points : 2 480
    Points
    2 480
    Par défaut
    oui, j'ai relancé le serveur...

    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
    java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.
     
            at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:581)
     
            at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:336)
     
            at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
     
            at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:183)
     
            at java.sql.DriverManager.getConnection(DriverManager.java:512)
     
            at java.sql.DriverManager.getConnection(DriverManager.java:193)
     
            at org.apache.jsp.Test_jsp._jspService(Test_jsp.java:70)
     
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
     
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
     
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
     
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
     
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
     
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
     
            at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
     
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
     
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
     
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
     
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
     
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
     
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
     
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
     
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
     
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
     
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
     
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
     
            at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
     
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
     
            at java.lang.Thread.run(Thread.java:534)
     
    Caused by: java.io.IOException: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.
     
            at net.sourceforge.jtds.jdbc.TdsCore.sendMSLoginPkt(TdsCore.java:1884)
     
            at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:554)
     
            ... 29 more

  7. #7
    Expert confirmé
    Avatar de Valère
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 334
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Août 2005
    Messages : 1 334
    Points : 4 740
    Points
    4 740
    Par défaut
    Avec un peu de google j'ai trouvé une solution ici.

    Il manque une DLL utilisée par ton driver.

    Valère

  8. #8
    Membre émérite Avatar de Cpt Anderson
    Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2005
    Messages
    626
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2005
    Messages : 626
    Points : 2 480
    Points
    2 480
    Par défaut
    Y'a du mieux, ca marche pas encore mais y'a du mieux !

    merci

  9. #9
    Expert confirmé
    Avatar de Valère
    Profil pro
    Inscrit en
    Août 2005
    Messages
    1 334
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Août 2005
    Messages : 1 334
    Points : 4 740
    Points
    4 740
    Par défaut
    N'hésite pas à poster la nouvelle exception!

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

Discussions similaires

  1. [D2005] Connexion à une BDD Access
    Par landry005 dans le forum Bases de données
    Réponses: 6
    Dernier message: 24/02/2006, 11h05
  2. Réponses: 5
    Dernier message: 03/02/2006, 13h47
  3. connexion à une bdd mysql en asp
    Par asetti dans le forum ASP
    Réponses: 3
    Dernier message: 31/10/2005, 18h31
  4. [Applet][MySQL] connexion à une BDD
    Par Michel38 dans le forum JDBC
    Réponses: 19
    Dernier message: 20/07/2005, 14h59
  5. Erreur de connexion à une BDD SQL Server 2000 avec BDE
    Par SchpatziBreizh dans le forum Bases de données
    Réponses: 3
    Dernier message: 17/06/2005, 11h22

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