Invalid SQL type: sqlKind = UNINITIALIZED error is shown

前端 未结 4 2039
慢半拍i
慢半拍i 2021-01-13 08:35
    String s1 = PasswordText4.getText();
    String s2 = ConfirmText4.getText();
    String s3 = NameText4.getText();
    String s4 = UsernameText4.getText();
    St         


        
相关标签:
4条回答
  • 2021-01-13 08:52

    Berger is right, you need to add spaces between your query parts, for example:

    String sql = " BEGIN "
               + " UPDATE LOGIN SET USERNAME = ?, PASSWORD = ?, NAME = ? "
               + " WHERE USERNAME = ?; "
               + " commit; "
               + " END;" ;
    
    0 讨论(0)
  • 2021-01-13 09:03

    You can do something likewise,

    String sql = "UPDATE LOGIN SET USERNAME = ?, PASSWORD = ?, NAME = ? WHERE USERNAME = ?" 
    
    PreparedStatement preparedStatement = dbConnection.prepareStatement(sql);
    preparedStatement .setString(1, UsernameText4.getText());
    preparedStatement .setString(2, PasswordText4.getText());
    preparedStatement .setString(3, NameText4.getText());
    preparedStatement .setString(4, jLabel16.getText());
    
    preparedStatement .executeUpdate();
    ....
    dbConnection.commit();
    
    0 讨论(0)
  • 2021-01-13 09:07

    Friends,

    I too encountered the same issue when I execute a sequence of SQL queries (few queries are commented thru my Java program

    Solution: Remove all commented SQL lines and then execute, you will not get "UNINITIALIED" error any more.

    0 讨论(0)
  • 2021-01-13 09:07

    java.sql.sqlexception: Invalid SQL type: sqlKind = UNINITIALIZED

    This error occurs when there is syntax error. check your syntax, Print the query and run the same query on your SQL client tool like SQL Developer, Toad, DBeaver..,

    Example: consider below is the o/p of Sysout

    [select * from dual] & ["select * from dual"] //sqlKind = UNINITIALIZED

    select * from dual // This is good

    Note all three queries run, but first two needs to be replace and []"" has to be removed before sending it for execution.

    0 讨论(0)
提交回复
热议问题