简体   繁体   English

JDBC SQL 服务器的驱动程序抛出 SqlServerException:调用使用游标的存储过程时“不支持操作”

[英]JDBC Driver for SQL Server throws SqlServerException: 'Operation not supported' while calling a stored procedure which uses cursors

I am trying to call a stored procedure using JDBC driver 6.0 for SQL Server and getting the error Operation not supported if the stored procedure uses cursors, XML manipulation and/or temporary tables.我正在尝试使用JDBC 驱动程序 6.0为 SQL 服务器调用存储过程,如果存储过程使用游标、XML 操作和/或临时表,则会收到错误Operation not supported

If I modify the stored procedure definition to have a simple select query then it works but if it has cursors or temporary tables it throws the error Operation not supported .如果我将存储过程定义修改为具有简单的 select 查询,则它可以工作,但如果它具有游标或临时表,则会抛出错误Operation not supported

I am using SQL Server 2008 .我正在使用SQL Server 2008

I call the stored procedure from WSO2 DSS server我从WSO2 DSS 服务器调用存储过程

The exact error which I get is this:我得到的确切错误是:

com.microsoft.sqlserver.jdbc.SQLServerException: This operation is not supported. com.microsoft.sqlserver.jdbc.SQLServerException:不支持此操作。 at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:102) at org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:73)在 org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:102) 在 org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.8821324:735888)

Here is the complete Stack-trace for the issue:这是该问题的完整堆栈跟踪:

DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processStoredProcQuery': This operation is not supported.

DS Code: DATABASE_ERROR
Source Data Service:-
Name: RMLDS
Location: C:\WSO2SO~1\WSO2DS~1.1\bin\..\tmp\carbonapps\-1234\1479805129410stap-capp_1.0.0.car\RMLDS_1.0.0\RMLDS-1.0.0.dbs
Description: 
Default Namespace: 
Current Request Name: _putorionsetuppagecount
Current Params: {xml=23}
Nested Exception:-
com.microsoft.sqlserver.jdbc.SQLServerException: This operation is not supported.
           at org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:75)
           at org.wso2.carbon.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:354)
           at org.wso2.carbon.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:41)
           at org.wso2.carbon.dataservices.core.DBInOutMessageReceiver.invokeBusinessLogic(DBInOutMessageReceiver.java:57)
           at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
           at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
           at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
           at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
           at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
           at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
           at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
           at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
           at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
           at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
           at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
           at org.owasp.csrfguard.CsrfGuardFilter.doFilter(CsrfGuardFilter.java:72)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
           at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
           at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
           at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
           at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
           at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
           at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
           at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
           at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
           at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
           at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
           at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)
           at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
           at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1756)
           at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1715)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
           at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
           at java.lang.Thread.run(Thread.java:745)

I found the problem.我发现了问题。
My stored procedure was taking a string as input, but the content of that string was xml.我的存储过程将一个字符串作为输入,但该字符串的内容是 xml。 So wso2 dss TryIt tool was failing with above error because i was passing it as <test/> , but i needed to pass it as &lt;Test/&gt;所以 wso2 dss TryIt 工具因上述错误而失败,因为我将它作为<test/>传递,但我需要将它作为&lt;Test/&gt; . .

I hope this helps others我希望这对其他人有帮助

Not sure but may be the reason , A server-side database cursor is not created if the requested result set type is a forward-only result set.不确定,但可能是原因,如果请求的结果集类型是只进结果集,则不会创建服务器端数据库游标。 May be try to set SelectMethod property as cursor.可以尝试将 SelectMethod 属性设置为光标。

https://docs.oracle.com/cd/E13157_01/wlevs/docs30/jdbc_drivers/mssqlserver.html https://docs.oracle.com/cd/E13157_01/wlevs/docs30/jdbc_drivers/mssqlserver.html

I had the same Operation not supported exception when I was trying to set networkTimout versus the sql server connection.当我尝试设置 networkTimout 与 sql server 连接时,我遇到了相同的Operation not supported异常。 I was using sqljdbc42 driver.我正在使用 sqljdbc42 驱动程序。 Here is the statement that caused the issue: con.setNetworkTimeout(executor, networkTimeout * 1000);这是导致问题的语句: con.setNetworkTimeout(executor, networkTimeout * 1000);
I know this was not the accurate answer versus the mentioned question;我知道这不是与上述问题相比的准确答案; I added this answer here because google gave me this answer for the exception I had.我在这里添加了这个答案,因为谷歌给了我这个异常的答案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft SQL Server JPA存储过程com.microsoft.sqlserver.jdbc.SQLServerException:&#39;{&#39;附近的语法不正确 - Microsoft SQL Server JPA Stored Procedure com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '{' 使用JDBC调用SQL Server存储过程时获取java.lang.NullPointerException - getting java.lang.NullPointerException while calling sql server stored Procedure using JDBC sql server 2008不支持JDBC驱动程序类 - JDBC driver class not supported with sql server 2008 在jdbc中调用存储过程 - Calling stored procedure in jdbc com.microsoft.sqlserver.jdbc.SQLServerException:不支持服务器版本。目标服务器必须是SQL Server 2000或更高版本 - com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later 使用JDBC从Java调用Oracle SQL中的存储过程的示例 - Example for calling a stored procedure in Oracle SQL from Java using JDBC 通过JDBC连接到MS SQL Server会引发SQLServerException - Connecting via JDBC to MS SQL Server raise an SQLServerException 从java调用MS Sql server存储过程,其中包含游标和时态表? - Calling MS Sql server stored procedure which has cursor and temporal table in it from java? Sybase 存储过程插入限制与 JDBC 驱动程序 - Sybase stored procedure insert limit with JDBC driver JDBC调用Microsoft SQL Server存储过程的同义词 - JDBC call to a synonym to Microsoft SQL Server stored procedure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM