“不是由SQLite JDBC驱动程序实现的" [英] "not Implemented by SQLite JDBC driver"

查看:83
本文介绍了“不是由SQLite JDBC驱动程序实现的"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含用户信息的数据库,我想创建一个公共静态变量,以便在任何给定时间返回数据库整数,而不必为每个数字都做一个空格,但这给了我这个错误:

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)

这是我的代码:

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;
        }
    }

有人知道我在做什么错吗?我尝试使用Google的东西,但是更改代码将我从一个错误转移到了另一个错误...因此,我现在还不能确定.

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.

我正在运行JDBC驱动程序sqlite-jdbc-3.8.11.2.jar

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.

这篇关于“不是由SQLite JDBC驱动程序实现的"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆