gpt4 book ai didi

java - com.microsoft.sqlserver.jdbc.SQLServerException : This operation is not supported

转载 作者:行者123 更新时间:2023-11-30 06:15:00 25 4
gpt4 key购买 nike

我正在使用 sql server 进行数据库连接。我想在运行多个结果集时保持结果集打开。我使用了 results = callableStatement.getMoreResults(Statement.KEEP_CURRENT_RESULT);但我在执行语句时收到以下错误,

com.microsoft.sqlserver.jdbc.SQLServerException: This operation is not supported. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:228) at com.microsoft.sqlserver.jdbc.SQLServerStatement.NotImplemented(SQLServerStatement.java:601) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMoreResults(SQLServerStatement.java:2136) at au.com.techcreations.readonly.PurchaseOrderList.Fetch(PurchaseOrderList.java:99) at au.com.techcreations.readonly.PurchaseOrderList.(PurchaseOrderList.java:37) at au.com.techcreations.readonly.PurchaseOrderList.getPurchaseOrderListByOrderNumber(PurchaseOrderList.java:46) at au.com.techcreations.test.PurchaseOrderTest.GetPurchaseOrderByOrderNumber(PurchaseOrderTest.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

由于我是sql server的新手,所以我对一些概念不太了解。如果有人知道为什么会发生这种情况,请回答我。

最佳答案

需要 SQL Server 中的单独连接才能同时处理多个结果集。 SQL Server 确实有 multiple active result sets (MARS)允许结果交错的功能,但我不认为 Microsoft JDBC 驱动程序当前支持此功能。需要使用 ODBC、OLE DB 或 SqlClient 以及适当的驱动程序才能使用 MARS。

就您而言,使用单独的连接是解决方案。我个人不是 MARS 的粉丝,经常看到它被错误地认为它允许并发或异步语句执行。

关于java - com.microsoft.sqlserver.jdbc.SQLServerException : This operation is not supported,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49424530/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com