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

JDBC Java Discussion :

[Exception] Type SQL non valide: sqlKind = 0


Sujet :

JDBC Java

  1. #1
    Membre habitué Avatar de hedgehog
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    295
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 295
    Points : 133
    Points
    133
    Par défaut [Exception] Type SQL non valide: sqlKind = 0
    Bonjour à tous,


    Après une longue recherche sur le net, je ne parviens pas à trouver la source de l'exception que mon application retourne :
    java.sql.SQLException: Type SQL non valide: sqlKind = 0
    Voici le code mis en place :
    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
        // Prepares connection properties and initializes database connection
        Properties properties = new Properties();
        properties.setProperty("user", database_username);
        properties.setProperty("password", database_password);
        properties.setProperty("autoReconnect", "true");
        Connection connection = DriverManager.getConnection(database_url, properties);
     
        // Prepares login query
        String archiveQuery =
            "SELECT" +
            "XXX, " +
            "YYY " +
            "FROM TABLE " +
            "WHERE " +
            "ZZZ = '" + data + "'"
        ;    
     
        // Executes login query
        Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        ResultSet resultset = statement.executeQuery(archiveQuery);
    L'Exception semble être levée à la ligne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ResultSet resultset = statement.executeQuery(archiveQuery);
    Si ça peut aider, voici la trace complète de l'exception :
    java.sql.SQLException: Type SQL non valide: sqlKind = 0
    at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:63)
    at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:999)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)
    at oracle.jdbc.driver.OracleStatement.doScrollExecuteCommon(OracleStatement.java:4644)
    at oracle.jdbc.driver.OracleStatement.doScrollStmtExecuteQuery(OracleStatement.java:4785)
    at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1484)
    at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:392)
    at org.apache.jsp.js.ajax.ajax_005fgetHistory_jsp._jspService(ajax_005fgetHistory_jsp.java:181)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at waffle.servlet.NegotiateSecurityFilter.doFilterPrincipal(Unknown Source)
    at waffle.servlet.NegotiateSecurityFilter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:237)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Pourriez-vous m'aider à ce sujet ? Pourquoi cette Exception est-elle levée ?


    Par avance, merci

  2. #2
    Membre éprouvé Avatar de fraco
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    750
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juin 2006
    Messages : 750
    Points : 934
    Points
    934
    Par défaut
    Salut !

    "ZZZ = '" + data + "'"
    apparemment que data n'est pas d'un type correct pour une transaction SQL...

    quels sont les types de ZZZ et de data ?

  3. #3
    Rédacteur/Modérateur
    Avatar de andry.aime
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    8 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Ile Maurice

    Informations forums :
    Inscription : Septembre 2007
    Messages : 8 391
    Points : 15 059
    Points
    15 059
    Par défaut
    Bonsoir
    1-
    "SELECT" +
    "XXX, " +
    Avec ce code, tu auras "SELECTXXX" .

    2- Utilise PreparedStatement pour ta requête.

    A+.

  4. #4
    Membre habitué Avatar de hedgehog
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    295
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 295
    Points : 133
    Points
    133
    Par défaut
    Merci de vos retours

    J'y regarde dès que possible et mets à jour la discussion.

  5. #5
    Membre habitué Avatar de hedgehog
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    295
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 295
    Points : 133
    Points
    133
    Par défaut
    Bien vu andry.aime, je ne devais pas avoir les yeux en face des trous (point 1).

    Encore merci de votre aide

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

Discussions similaires

  1. Conversion de chaîne "" en type Double non valide
    Par vérokit dans le forum VB.NET
    Réponses: 2
    Dernier message: 10/04/2008, 08h14
  2. Requete Sql Non Valide
    Par Thesum dans le forum Langage SQL
    Réponses: 9
    Dernier message: 21/02/2008, 19h44
  3. ORA-00900 Instructions SQL non valides
    Par yLaplace dans le forum JDBC
    Réponses: 0
    Dernier message: 03/12/2007, 12h45
  4. [sql] instruction sql non valide
    Par liloo31 dans le forum Requêtes et SQL.
    Réponses: 2
    Dernier message: 15/12/2006, 14h15
  5. [VB.Net] cast du type 'DataRowview' en type 'Date' non valide
    Par badnane2 dans le forum Windows Forms
    Réponses: 4
    Dernier message: 14/06/2006, 15h50

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