java.sql.SQLSyntaxErrorException: Error preparing query: Unknown column 'TMP.alerte_code' in 'field list'

JIRA | Régis Augui | 11 months ago
  1. 0

    Hi, The following example works well with mysql-connector-java-5.1.38-bin.jar but not with MariaDB-java-client-1.3.3.jar Here is the error: java.sql.SQLSyntaxErrorException: Error preparing query: Unknown column 'TMP.alerte_code' in 'field list' at org.mariadb.jdbc.internal.util.ExceptionMapper.get(ExceptionMapper.java:125) at org.mariadb.jdbc.internal.util.ExceptionMapper.throwException(ExceptionMapper.java:69) at org.mariadb.jdbc.MariaDbServerPreparedStatement.prepare(MariaDbServerPreparedStatement.java:117) at org.mariadb.jdbc.MariaDbServerPreparedStatement.<init>(MariaDbServerPreparedStatement.java:87) at org.mariadb.jdbc.MariaDbConnection.internalPrepareStatement(MariaDbConnection.java:375) at org.mariadb.jdbc.MariaDbConnection.prepareStatement(MariaDbConnection.java:222) at org.rfa.test.FirstExample.main(FirstExample.java:30) Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Error preparing query: Unknown column 'TMP.alerte_code' in 'field list' at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.prepare(AbstractQueryProtocol.java:152) at org.mariadb.jdbc.MariaDbServerPreparedStatement.prepare(MariaDbServerPreparedStatement.java:99) ... 4 more Thanks *example :* {code:java} import java.sql.*; public class FirstExample { static final String JDBC_DRIVER = "org.mariadb.jdbc.Driver"; static final String DB_URL = "jdbc:mariadb://localhost:3306/Test"; // static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; // static final String DB_URL = "jdbc:mysql://localhost:3306/WearPdm"; static final String USER = "test"; static final String PASS = "test"; static final String _SQL = "insert into alerte ( alerte_code, alerte_libelle_court, alerte_libelle_long )" + "select TMP.alerte_code, TMP.alerte_libelle_court, TMP.alerte_libelle_long " + "from ( " + "select ? alerte_code, ? alerte_libelle_court, ? alerte_libelle_long " + "from dual " + ") TMP"; public static void main(String[] args) { Connection conn = null; PreparedStatement stmt = null; try { Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL,USER,PASS); stmt = conn.prepareStatement(_SQL); stmt.setString(1, "test"); stmt.setString(2, "test"); stmt.setString(3, "test"); stmt.executeUpdate(); stmt.close(); conn.close(); } catch(SQLException se) { se.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } finally { try { if(stmt!=null) stmt.close(); } catch(SQLException se2){ } try { if(conn!=null) conn.close(); } catch(SQLException se) { se.printStackTrace(); } } } } {code}

    JIRA | 11 months ago | Régis Augui
    java.sql.SQLSyntaxErrorException: Error preparing query: Unknown column 'TMP.alerte_code' in 'field list'
  2. 0

    GitHub comment 3#254662574

    GitHub | 2 months ago | rockmacaca
    java.sql.SQLSyntaxErrorException: Error preparing query: Table 'projectworlds.settings' doesn't exist
  3. 0

    Unknown exception running process

    GitHub | 9 months ago | jmreicha
    org.jooq.exception.DataAccessException: SQL [insert into `process_execution` (`process_instance_id`, `uuid`, `log`, `created`) values (?, ?, ?, ?)]; Unknown column 'created' in 'field list'
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 4202#203722618

    GitHub | 8 months ago | jmreicha
    org.jooq.exception.DataAccessException: SQL [select `config_item_status`.`id`, `config_item_status`.`name`, `config_item_status`.`requested_version`, `config_item_status`.`applied_version`, `config_item_status`.`source_version`, `config_item_status`.`requested_updated`, `config_item_status`.`applied_updated`, `config_item_status`.`agent_id`, `config_item_status`.`account_id`, `config_item_status`.`service_id`, `config_item_status`.`resource_id`, `config_item_status`.`resource_type`, `config_item_status`.`environment_id` from `config_item_status` where (`config_item_status`.`name` in (?) and `config_item_status`.`resource_type` = ? and `config_item_status`.`resource_id` = ?)]; Unknown column 'config_item_status.environment_id' in 'field list'
  6. 0

    Initializing rancher command with external mysql cluster failes

    GitHub | 4 months ago | lukaskroepfl
    liquibase.exception.DatabaseException: Error executing SQL CREATE INDEX idx_volume_uri ON rancher.volume(uri): Index column size too large. The maximum column size is 767 bytes.

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.mariadb.jdbc.internal.util.dao.QueryException

      Error preparing query: Unknown column 'TMP.alerte_code' in 'field list'

      at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.prepare()
    2. org.mariadb.jdbc
      AbstractQueryProtocol.prepare
      1. org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.prepare(AbstractQueryProtocol.java:152)
      1 frame
    3. mariadb-java-client
      MariaDbConnection.prepareStatement
      1. org.mariadb.jdbc.MariaDbServerPreparedStatement.prepare(MariaDbServerPreparedStatement.java:99)
      2. org.mariadb.jdbc.MariaDbServerPreparedStatement.<init>(MariaDbServerPreparedStatement.java:87)
      3. org.mariadb.jdbc.MariaDbConnection.internalPrepareStatement(MariaDbConnection.java:375)
      4. org.mariadb.jdbc.MariaDbConnection.prepareStatement(MariaDbConnection.java:222)
      4 frames
    4. org.rfa.test
      FirstExample.main
      1. org.rfa.test.FirstExample.main(FirstExample.java:30)
      1 frame