- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在使用最新的 derby10.11.1.1。做这样的事情:
DriverManager.registerDriver(new org.apache.derby.jdbc.EmbeddedDriver())
java.sql.Connection connection = DriverManager.getConnection("jdbc:derby:filePath", ...)
Statement stmt = connection.createStatement();
stmt.setQueryTimeout(2); // shall stop query after 2 seconds but id does nothing
stmt.executeQuery(strSql);
stmt.cancel(); // this in fact would run in other thread
我得到异常 "java.sql.SQLFeatureNotSupportedException: Caused by: ERROR 0A000: Feature not implemented: cancel"
你知道是否有办法让它发挥作用吗?或者它真的没有在 Derby 中实现,我需要使用不同的嵌入式数据库吗?关于一些免费数据库的任何提示,我可以使用它代替 derby 并且支持 SQL 超时?
最佳答案
当我进入 java 文档时
void cancel() throws SQLException
Cancels this Statement object if both the DBMS and driver support aborting an SQL statement. This method can be used by one thread to cancel a statement that is being executed by another thread.
它会抛出
SQLFeatureNotSupportedException
- 如果 JDBC 驱动程序不支持此方法
你可以使用 mysql
。有这么多可用的嵌入式数据库,你可以通过 embedded database
关于java - 如何停止正在进行的 java.sql.statement.executeQuery()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30331580/
我有两个类:样本和参数。我还有一个sample_sample_parameter查找表,该表用于保存样本ID和参数ID。这映射在我的grails应用程序中。 我能够编写一个可在松鼠中使用的sql查询:
我有一个由以下人员执行的 SQL 查询: ResultSet resultSet = preparedStatement.executeQuery(); while( resultSet.next()
我有一个问题,我尝试使用 sp 但我得到了 The executeQuery method must return a result 如果我使用 cs.execute(); 和 ResultSet r
我正在创建一个简单的应用程序,它使用 JDBC 从 MySQL 获取数据。我使用 dao 从数据库中获取数据。除了一个之外,所有其他都工作正常(所有 DAO 的代码都相同)。此外,我还手动提交 INS
下面的语句是否存在任何条件 PreparedStatement.executeQuery() 不返回或抛出异常? 最佳答案 这取决于您使用的数据库和配置的隔离级别。一个常见的默认设置是,如果您尝试选择
我在返回结果集中收到此错误。无法将结果集的结果转换为 double 。 不是可以返回一个double吗?我该怎么办? public double getBalance( String name ) {
我正在处理一个包含三个表的数据库: 我想插入一条新记录,首先将信息添加到 DonorInformation 和 NeedyInformation 中。然后,从两条记录中获取主 ID 后,应将其插入到
我正在尝试编写一个方法来检查我的数据库,如果用户有权执行某个方法。 执行查询后得到的响应为空。 我有以下方法可以做到这一点: public boolean checkRole(String e
ExecuteQuery() 方法返回一个 IEnumerable,但有没有办法让它返回 IQueryable? 最佳答案 嗯,你可以调用AsQueryable ,但不会有任何好处。问题是当你使用 E
我使用 Breeze Promise ExecuteQuery 从数据库获取数据: var getdata = function(){ var manager = new breeze.Ent
我有 3 个 jComboBox。第一个是房间类型。当我在第一个 jComboBox 上选择房间类型时,它必须在第二个 jComboBox 中显示所有可用房间,但是当我选择其中一个房间类型时,会弹出错
我的查询 def myQuery = PublicTraining.executeQuery("SELECT t.id, t.isSoldOut, t.course.ebPrice, t.offe
statement = conRecieved.createStatement(); resultSet = statement.executeQuery("Select * from actor")
我正在使用最新的(截至今天)BreezeJS、AngularJS、.NET、Entity Framework 等。 我有一个看起来设置正确的 Breeze 应用程序,但是从 executeQuery(
以下 Java 代码返回一个空结果集,但 SQL 显示表中有数据: @Override public List list() { List list = new ArrayList<>();
这个问题已经有答案了: Invalid state, the ResultSet object is closed (1 个回答) 已关闭 8 年前。 给出以下代码: //connection
我正在使用 ExecuteQuery (www.executequery.org ) 连接到远程 Oracle 数据库。我收到了一个 .sql 文件,我应该在这个数据库上运行它。但我什至无法将此文件加
似乎无法解决这个问题。在过去的一个小时里一直在努力让它发挥作用。任何帮助将不胜感激。 INFO: Server startup in 868 ms java.sql.SQLException: Can
假设有一些 Oracle PL/SQL 过程,它接收 IN 参数并返回 OUT 游标参数。我有一个执行此过程的 jdbc 代码: DataSource dataSource; //dataso
我正在使用 MySQL 编写一个简单的 JDBC 程序,但是只有一行代码出了什么问题。我没有看到任何错误,但下面提到的行在运行程序时显示错误 代码- ResultSet recs = psmt.exe
我是一名优秀的程序员,十分优秀!