Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving data Encountered unexpected unknown token #770

Closed
alsaghir opened this issue Aug 1, 2018 · 10 comments
Closed

Retrieving data Encountered unexpected unknown token #770

alsaghir opened this issue Aug 1, 2018 · 10 comments

Comments

@alsaghir
Copy link

alsaghir commented Aug 1, 2018

Driver version or jar name

Tried 6.4.0, 6.2.2 and 6.2.1

SQL Server version

Microsoft SQL Server 2014 - 12.0.2000.8 (X64)

Client operating system

Windows Server 2012

Java/JVM version

java version "1.7.0", Oracle

Table schema

CREATE TABLE "dbo"."incoming_correspondence" (
"version_Id" bigint NOT NULL,
"IncomingNo" varchar(100) NULL,
"Date" decimal(18,5) NULL,
"ExtEntityOutgoingNo" varchar(50) NULL,
"ExtDate" decimal(18,5) NULL,
"IncomingType" varchar(50) NULL,
"ExternalEntity" varchar(50) NULL,
"barcode" varchar(100) NULL,
"ExternalEntityCode" varchar(50) NULL,
"RoutingSource" varchar(50) NULL,
"ElectronicDesc" varchar(4000) NULL,
"OriginalSourceUnit" varchar(50) NULL,
"Routing" varchar(1024) NULL,
"OtherRouting" varchar(50) NULL,
"correspondent" varchar(100) NULL,
"attachmentsDesc" varchar(4000) NULL,
"incomingDeliveryMethod" varchar(50) NULL,
"concernedState" varchar(50) NULL,
"concernedStateOptions" varchar(50) NULL,
"original_paper_code" varchar(50) NULL,
"test_field" varchar(50) NULL,
"corr_status" varchar(1024) NULL,
"signature" varbinary(max) NULL,
"attachments" varchar(50) NULL,
CONSTRAINT "PK__name_inco__07A684B1737A6C8B" PRIMARY KEY CLUSTERED("version_Id")
ON [PRIMARY]);

Problem description

Using c3p0 0.9.2.1, hibernate 4.2.21, JBoss AS 7.1.1 and connecting with Microsoft SQL Server 2014 - 12.0.2000.8 (X64).

mssql-jdbc 6.2.2 (I tested 6.4.0 for doubt but we are using 6.2.2) is used for JRE7 support.

Scenario

Retrieving data from a table as multiple rows but NOT at once. It's simply a loop and each time a row retrieved and finally they put in HashMap.

Problem & Output

After long investigation and debugging I found out that the problem scope related with two columns in the table. One is VARBINARY(MAX) called signature and the other is VARCHAR(1024) called status. If both of these columns have a value on a row, this exception occurs on retrieving the next row. If any of them is set to null, all is good. No matter the length of the value in them.

Tries so far

  • Changing the columns order making the VARCHARcolumn is the last cloumn
  • Changing the columns order making the VARBINARY column is the last cloumn
  • Changing the length (VARBINARY to 8000 and VARCHAR to 50)
  • Setting values on other columns with similar or larger length
  • Logging org.hibernate.session object methods isConnected() and isOpen() and until the exception is thrown, the output was always true for both

Questions

What does that exception means ? Specially that sql server logging doesn't show anything about it !!

Why it's happening and what might be the cause of this ?


    18:53:12,294 SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.TOKEN]
(http-localhost-127.0.0.1-8080-6) ConnectionID:24 ClientConnectionId:
5bbf35a7-2a3c-4fb5-845a-bbd81d2739ef: getNextResult: Encountered
unexpected unknown token (0x1)
    18:53:12,296 SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.Reader]
(http-localhost-127.0.0.1-8080-6) ConnectionID:24 ClientConnectionId:
5bbf35a7-2a3c-4fb5-845a-bbd81d2739ef got unexpected value in TDS
response at offset:1158
    18:53:12,300 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) java.lang.reflect.InvocationTargetException
    
    18:53:12,300 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    
    18:53:12,301 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    
    18:53:12,301 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    
    18:53:12,302 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at java.lang.reflect.Method.invoke(Unknown Source)
.
.
    18:53:12,304 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    
    18:53:12,305 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    
    18:53:12,306 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    
    18:53:12,307 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    
    18:53:12,308 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    
    18:53:12,309 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    
    18:53:12,309 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    
    18:53:12,310 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    
.
.
    18:53:12,312 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    
    18:53:12,312 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    
.
.
    
    18:53:12,314 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    
    18:53:12,314 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    
.
.   
    18:53:12,316 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    
    18:53:12,316 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    
    18:53:12,317 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:101)
    
    18:53:12,318 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    
    18:53:12,318 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    
    18:53:12,319 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
    
    18:53:12,320 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    
    18:53:12,320 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
    
    18:53:12,321 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
    
    18:53:12,322 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    
    18:53:12,322 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    
    18:53:12,323 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
    
    18:53:12,324 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
    
    18:53:12,325 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
    
    18:53:12,326 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
    
    18:53:12,327 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at java.lang.Thread.run(Unknown Source)
    
    18:53:12,328 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) Caused by: org.hibernate.exception.GenericJDBCException: could not
extract ResultSet
    
    18:53:12,329 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
    
    18:53:12,330 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)
    
    18:53:12,332 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
    
    18:53:12,333 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:88)
    
    18:53:12,335 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.Loader.getResultSet(Loader.java:2062)
    
    18:53:12,336 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1859)
    
    18:53:12,337 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838)
    
    18:53:12,338 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.Loader.doQuery(Loader.java:906)
    
    18:53:12,339 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348)
    
    18:53:12,340 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.Loader.doList(Loader.java:2550)
    
    18:53:12,340 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.Loader.doList(Loader.java:2536)
    
    18:53:12,341 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2366)
    
    18:53:12,342 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.Loader.list(Loader.java:2361)
    
    18:53:12,342 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:495)
    
    18:53:12,343 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:357)
    
    18:53:12,343 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:198)
    
    18:53:12,344 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1230)
    
    18:53:12,345 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
    
    18:53:12,345 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.internal.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:909)
    
.
.
    
    18:53:12,350 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	... 38 more
    
    18:53:12,351 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The
connection is closed.
    
    18:53:12,351 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:228)
    
    18:53:12,352 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:1007)
    
    18:53:12,353 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at com.microsoft.sqlserver.jdbc.SQLServerStatement.checkClosed(SQLServerStatement.java:1024)
    
    18:53:12,353 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:198)
    
    18:53:12,354 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:401)
    
    18:53:12,355 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:116)
    
    18:53:12,355 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:79)
    
    18:53:12,356 ERROR [stderr] (http-localhost-127.0.0.1-8080-6) 	... 59 more

Expected behavior and actual behavior

To parse/retrieve fields correctly and successfully

Repro code

I'm not sure how that possible since I do not know the main reason for the issue and we have been facing this issue for long time now (about more than week) and were at the beginning are struggling to reproduce such issue on our local environments.

@cheenamalhotra
Copy link
Member

Hi @anddo88

I tried reproducing your usecase with above table structure and randomized data in all columns (no null data), but I couldn't reproduce the error reading directly from driver side. I too tested with different drivers (6.2.2, 6.4.0) with jdk1.7.0_80_x64, but no luck.

The error you specified, is coming from the driver. And it looks like the connection is dropping during reading this data.

As you see "The connection is closed" is a com.microsoft.sqlserver.jdbc.SQLServerException thrown by the JDBC driver. I'd like to ask a few questions:

  • Have you tested reproducing same scenario in your local machine, by setting up a local database? Just to make sure there are no network problems?
  • I'd also request you to provide me a few rows of sample data of what these columns contain in your case that fails during data read operation. An INSERT SQL would be helpful (We recommend tampering data to maintain data security for customers, but provide us some tampered data that reproduces the error)

@alsaghir
Copy link
Author

alsaghir commented Aug 2, 2018

Hi cheena,

Thank you for your response. Connection is closed while retrieving a row after the last row has (for some reason) closed the connection. Here is a sample insert for one row as we made the column in question () equals null in all rows

INSERT INTO incoming_correspondence (version_Id,IncomingNo,Date,ExtEntityOutgoingNo,ExtDate,IncomingType,ExternalEntity,barcode,ExternalEntityCode,RoutingSource,ElectronicDesc,OriginalSourceUnit,Routing,OtherRouting,correspondent,attachmentsDesc,incomingDeliveryMethod,concernedState,concernedStateOptions,original_paper_code,test_field,corr_status,signature,attachments) VALUES(50641,null,2458331.50000,null,null,'190','102',null,'102','100',null,null,'أخرى',null,null,null,null,'جمهورية كوريا الجنوبية','180',null,null,null,'696d6167652f6a7369676e61747572653b6261736533302c32495a3232303059333536366561383833343566696863335a32353535376663636662383739626864383359326b5f314a5a333661393535303059646563383231305a36613838353632313030593638383935333130305a343432323330','ff');

The columns in question are corr_status and signature. But nulling all corr_status solved the problem until we inserted new column which is attachments and any value of this column along with the ssignature causes this exception.

Have you tested reproducing same scenario in your local machine, by setting up a local database? Just to make sure there are no network problems?

No. I will walk in this scenario but it will take time as the application is not small one

I'd also request you to provide me a few rows of sample data of what these columns contain in your case that fails during data read operation. An INSERT SQL would be helpful (We recommend tampering data to maintain data security for customers, but provide us some tampered data that reproduces the error)

Here is a sample and you can repeat that row and as you see the last column might even got data inserted manually to reproduce the issue. However, I don't know what's exactly might cause the problem so I am not sure of reproduction of the case of course

INSERT INTO incoming_correspondence (version_Id,IncomingNo,Date,ExtEntityOutgoingNo,ExtDate,IncomingType,ExternalEntity,barcode,ExternalEntityCode,RoutingSource,ElectronicDesc,OriginalSourceUnit,Routing,OtherRouting,correspondent,attachmentsDesc,incomingDeliveryMethod,concernedState,concernedStateOptions,original_paper_code,test_field,corr_status,signature,attachments) VALUES(50641,null,2458331.50000,null,null,'190','102',null,'102','100',null,null,'أخرى',null,null,null,null,'جمهورية كوريا الجنوبية','180',null,null,null,'696d6167652f6a7369676e61747572653b6261736533302c32495a3232303059333536366561383833343566696863335a32353535376663636662383739626864383359326b5f314a5a333661393535303059646563383231305a36613838353632313030593638383935333130305a343432323330','ff');

Again, thank you :)

@alsaghir
Copy link
Author

alsaghir commented Aug 7, 2018

OK there is an update, after trying to convert hibernate hql query to sql query using JDBC directly, the following exception occurs which is pretty similar to the previous one specially in unexpected token concern

17:45:02,384 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) org.hibernate.exception.DataException: could not execute statement

17:45:02,385 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:135)

17:45:02,385 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

17:45:02,386 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)

17:45:02,387 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)

17:45:02,388 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:136)

17:45:02,389 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:58)

17:45:02,390 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3067)

17:45:02,391 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3509)

17:45:02,391 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)

17:45:02,392 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:364)

17:45:02,393 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:356)

17:45:02,394 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:277)

17:45:02,395 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:328)

17:45:02,396 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)

17:45:02,397 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234)

17:45:02,397 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .


17:45:02,398 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,399 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,400 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,401 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,402 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,402 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)

17:45:02,403 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)

17:45:02,404 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)

17:45:02,405 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

17:45:02,406 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)

17:45:02,406 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

17:45:02,407 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

17:45:02,408 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,409 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,410 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

17:45:02,411 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,412 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,412 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

17:45:02,413 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,414 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,415 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

17:45:02,416 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,417 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:101)

17:45:02,417 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

17:45:02,418 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,419 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

17:45:02,420 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

17:45:02,421 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

17:45:02,422 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

17:45:02,423 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

17:45:02,424 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

17:45:02,424 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

17:45:02,425 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

17:45:02,426 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

17:45:02,426 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

17:45:02,427 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at java.lang.Thread.run(Unknown Source)

17:45:02,428 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: An error occurred while reading the value from the stream object. Error: "java.io.IOException: The stream is closed."

17:45:02,429 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.TDSWriter.error(IOBuffer.java:3960)

17:45:02,430 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.TDSWriter.writeStream(IOBuffer.java:3755)

17:45:02,430 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.TDSWriter.writeRPCInputStream(IOBuffer.java:5994)

17:45:02,431 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.DTV$SendByRPCOp.execute(dtv.java:1421)

17:45:02,432 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.DTV.executeOp(dtv.java:1847)

17:45:02,432 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.DTV.sendByRPC(dtv.java:1896)

17:45:02,433 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.Parameter.sendByRPC(Parameter.java:1157)

17:45:02,433 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.sendParamsByRPC(SQLServerPreparedStatement.java:527)

17:45:02,434 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(SQLServerPreparedStatement.java:843)

17:45:02,435 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:463)

17:45:02,436 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:409)

17:45:02,437 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7151)

17:45:02,437 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2478)

17:45:02,438 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:219)

17:45:02,439 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:199)

17:45:02,439 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:356)

17:45:02,440 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:147)

17:45:02,441 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)

17:45:02,441 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	... 47 more

17:45:02,442 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) org.hibernate.exception.DataException: could not execute statement

17:45:02,442 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:135)

17:45:02,443 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

17:45:02,444 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)

17:45:02,445 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)

17:45:02,446 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:136)

17:45:02,446 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:58)

17:45:02,447 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3067)

17:45:02,448 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3509)

17:45:02,448 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)

17:45:02,449 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:364)

17:45:02,450 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:356)

17:45:02,450 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:277)

17:45:02,451 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:328)

17:45:02,452 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)

17:45:02,452 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234)

17:45:02,453 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,453 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,454 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,455 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,455 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,456 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,457 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)

17:45:02,458 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)

17:45:02,458 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)

17:45:02,459 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

17:45:02,460 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)

17:45:02,461 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

17:45:02,462 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

17:45:02,463 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,464 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,465 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

17:45:02,466 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,467 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,468 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

17:45:02,469 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,470 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at .

17:45:02,471 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

17:45:02,473 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,474 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:101)

17:45:02,474 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

17:45:02,475 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

17:45:02,476 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

17:45:02,477 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

17:45:02,478 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

17:45:02,479 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

17:45:02,480 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

17:45:02,481 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

17:45:02,482 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

17:45:02,483 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

17:45:02,485 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

17:45:02,486 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

17:45:02,487 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at java.lang.Thread.run(Unknown Source)

17:45:02,487 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: An error occurred while reading the value from the stream object. Error: "java.io.IOException: The stream is closed."

17:45:02,489 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.TDSWriter.error(IOBuffer.java:3960)

17:45:02,490 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.TDSWriter.writeStream(IOBuffer.java:3755)

17:45:02,491 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.TDSWriter.writeRPCInputStream(IOBuffer.java:5994)

17:45:02,492 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.DTV$SendByRPCOp.execute(dtv.java:1421)

17:45:02,492 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.DTV.executeOp(dtv.java:1847)

17:45:02,493 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.DTV.sendByRPC(dtv.java:1896)

17:45:02,494 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.Parameter.sendByRPC(Parameter.java:1157)

17:45:02,495 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.sendParamsByRPC(SQLServerPreparedStatement.java:527)

17:45:02,497 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(SQLServerPreparedStatement.java:843)

17:45:02,498 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:463)

17:45:02,499 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:409)

17:45:02,500 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7151)

17:45:02,501 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2478)

17:45:02,501 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:219)

17:45:02,502 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:199)

17:45:02,502 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:356)

17:45:02,503 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:147)

17:45:02,504 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)

17:45:02,505 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) 	... 47 more

17:45:02,507 SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.TOKEN] (http-localhost-127.0.0.1-8080-2) ConnectionID:73 ClientConnectionId: ebfce55d-b7b9-4427-a6db-4ecfed90bf65: getNextResult: Encountered unexpected unknown token (0x4)
17:45:02,508 SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (http-localhost-127.0.0.1-8080-2) ConnectionID:73 ClientConnectionId: ebfce55d-b7b9-4427-a6db-4ecfed90bf65 got unexpected value in TDS response at offset:1342

@cheenamalhotra
Copy link
Member

Hi @anddo88 This error is different than before as it says could not execute statement and The stream is closed.
Can you share you query and how are you trying to execute it?

@alsaghir
Copy link
Author

alsaghir commented Aug 8, 2018

Here it is the java code and the query is commented below

public Object findById(final CmsTemplateModel correspondnce,final Long versionId) throws IllegalStateException , IllegalArgumentException
    {
        final HashMap<String, Object> map = new HashMap<String, Object>();
try {

	Connection connection = hibernateSession.doReturningWork(new ReturningWork<Connection>() {
        @Override
        public Connection execute(Connection conn) throws SQLException {
            return conn;
        }
    });

// This is the query which is for example
// select * from incoming_correspondence where version_id = 5027
    String queryStr= "select * from " + ""+correspondnce.getInternalName() + " where version_id = " +versionId ;

    Statement stmt = connection.createStatement();
    ResultSet rs = stmt.executeQuery(queryStr);
    ResultSetMetaData meta = rs.getMetaData();

   	while(rs.next())
   	{
   		for (int i = 1; i <= meta.getColumnCount(); i++) {
            String key = meta.getColumnName(i);
            int type=meta.getColumnType(i);
            map.put(key, getSqlType(rs, key, type));
        }
   	}
}
catch(Exception ex) {
	ex.printStackTrace();
}
		
      return map;

    }

I also tried to close the resultset after the while loop and the statement too but still same error. The common between to issues is the unexpected token and the stream is closed which was connection is closed in the first comment. I hope this helps you to find the cause or solution to this.

@cheenamalhotra
Copy link
Member

Hi @anddo88

I've tried to reproduce your scenario, but I don't get any problem in reading the data from any column iteratively. In your sample code above, I see you're trying to read data from a row and processing it.

I've uploaded a gist to reproduce your data/scenario, please confirm running this code works for you in your environment, and if you can modify and make it fail, I can then try to look into the cause.

@alsaghir
Copy link
Author

OK I'll test this and reply as soon as possible

@cheenamalhotra
Copy link
Member

Hi @anddo88
Do you have any update on this issue?

@cheenamalhotra
Copy link
Member

Closing due to inactivity

@hevald
Copy link

hevald commented May 29, 2023

If anytone else finds this, it seem he found the solution here https://stackoverflow.com/a/52748707/1362043.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants