简体   繁体   中英

“not Implemented by SQLite JDBC driver”

I have a database with User information, and I wanted to make a public static to return the database integers at any given time without having to make a void for every single one, but it's giving me this error:

0
java.sql.SQLException: not implemented by SQLite JDBC driver
    at org.sqlite.jdbc3.JDBC3PreparedStatement.unused(JDBC3PreparedStatement.java:466)
    at org.sqlite.jdbc3.JDBC3PreparedStatement.executeQuery(JDBC3PreparedStatement.java:506)
    at dysanix.main.checkUserColumnInt(main.java:726)
    at dysanix.main.main(main.java:50)

And this is my code:

public static int checkUserColumnInt(String column, String user) {
        try {
            Connection connection = DriverManager.getConnection("jdbc:sqlite:Database.db");
            String query = "Select ? from userSettings WHERE user = ?";
            PreparedStatement statement = connection.prepareStatement(query);

            statement.setString(1, column);
            statement.setString(2, user);
            
            ResultSet result = statement.executeQuery(query);
            
            result.next();
            int columnResult = result.getInt(column);
            return columnResult;
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }

Does someone understand what I'm doing wrong? I tried to Google things, but changing code around moved me from one error to the next... so I'm not really certain anymore at this point.

I am running JDBC driver sqlite-jdbc-3.8.11.2.jar

PreparedStatement.executeQuery(String sql) is not implemented. I guess you just want to call executeQuery() . The query is defined by the PreparedStatement already.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM