|
| Reading from InputStream Problem |
 |
Tue, 24 Jul 2007 03:40:40 EDT |
I have stored a page in database as BLOB and reading as getBinaryStream.
While reading, the InputStream returned is passed to other method for reading
the content. But i am getting the following exception for some time and some
time it works properly. Is this issue, related to common connection used for
all JSPs in my application. Can you please tell me, what could be the problem
and what would be the solution?
Thanking you,
Sandip Bhoi.
java.io.IOException: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT]
SQL0423N Locator variable "1" does not currently represent any value.
SQLSTATE=0F001
at COM.ibm.db2.jdbc.app.DB2InputStream.read(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2InputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at
com.ubics.utils.html.ScriptGenerator.generateScript(ScriptGenerator.java:85)
at org.apache.jsp.loadForm_jsp._jspService(loadForm_jsp.java:156)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.
java:173)
at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.jav
a:362)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.
java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:2
13)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:1
78)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107
)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnectio
n(Http11Protocol.java:744)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:52
7)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorker
Thread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:68
4)
at java.lang.Thread.run(Thread.java:595)
|
| Post Reply
|
| Re: Reading from InputStream Problem |
 |
Tue, 24 Jul 2007 13:44:50 +020 |
sandip.bhoi@gmail.com wrote:
> I have stored a page in database as BLOB and reading as getBinaryStream.
> While reading, the InputStream returned is passed to other method for
> reading the content. But i am getting the following exception for some
> time and some time it works properly. Is this issue, related to common
> connection used for all JSPs in my application. Can you please tell me,
> what could be the problem and what would be the solution?
>
> Thanking you,
> Sandip Bhoi.
>
> java.io.IOException: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI
> Driver][DB2/NT] SQL0423N Locator variable "1" does not
currently
> represent any value. SQLSTATE=0F001
A typical problem for this error is that you did not turn off auto-commit
(which is something you should do as the first thing after connect in a
Java application).
--
Knut Stolze
DB2 z/OS Utilities Development
|
| Post Reply
|
| Re: Reading from InputStream Problem |
 |
Wed, 25 Jul 2007 05:07:40 EDT |
Using new connection for each read do not cause above problem?
i.e
Earlier, i was using
DBFactory _instace = DBFactory.getInstance(); // returns singltone
instance
Connection con = _instance.getConnection(); // returns the connection
instance in the object
But now,
i am Creating new connection each time as
Connection con = DriverManager.getConnection(..,..,..);
And this new connection do not throws such exception.
But actual what is the reason?
>A typical problem for this error is that you did not turn
>off auto-commit(which is something you should do as the first
>thing after connect in a Java application).
>
|
| Post Reply
|
| Re: Reading from InputStream Problem |
 |
Wed, 25 Jul 2007 20:09:51 +020 |
sandip.bhoi@gmail.com wrote:
> Using new connection for each read do not cause above problem?
>
> i.e
>
> Earlier, i was using
>
> DBFactory _instace = DBFactory.getInstance(); // returns singltone
> instance
> Connection con = _instance.getConnection(); // returns the
> connection instance in the object
>
>
> But now,
>
> i am Creating new connection each time as
> Connection con = DriverManager.getConnection(..,..,..);
>
>
> And this new connection do not throws such exception.
>
> But actual what is the reason?
Then I guess you were using the same connection object in different threads
and one thread run a COMMIT operation (potentially due to auto-commit)
while the other thread was accessing LOBs. LOBs are handled by default via
LOB locators. And a locator is valid in the current unit of work
(transaction) only. So a commit will automatically invalidate all current
locators.
--
Knut Stolze
DB2 z/OS Utilities Development
|
| Post Reply
|
|
|
|
|
|
|
|
|
|