Solved

multi-threading and JDBC Oracle 8i thin driver

Posted on 2002-03-06
5
436 Views
Last Modified: 2008-03-03
I would appreciate if anyone could explain this problem for me:

In my program I am creating a thread to insert records in dB, several threds are running at the same time to do tnhe same functionality . I don't know if this helps I am using JDBC Oracle 8i thin driver and multi-threading and keep getting this problem:


Protocol violation
java.sql.SQLException: Io exception: not in streaming mode
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
        at oracle.jdbc.driver.OracleStatement.freeLine(OracleStatement.java:4621)
        at oracle.jdbc.driver.OracleConnection.needLine(OracleConnection.java:1627)
        at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:412)
        at oracle.jdbc.driver.OracleConnection.privateCreateStatement(OracleConnection.java:474)
        at oracle.jdbc.driver.OracleConnection.createStatement(OracleConnection.java:383)

0
Comment
Question by:shakfan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
kelfink earned 80 total points
ID: 6844856
If you are using one connectin for multiple threads, this is the problem.  Each concurrent thread needs its own connection.

TO reduce the cost of connecting for each thread, use a Connection Pool.  
0
 
LVL 9

Expert Comment

by:Venci75
ID: 6846603
in addition to kelfink's comment, you can enclose the usage of the connection in your code:
synchronyzed (conn) {
// using the connection
}

Make sure that every peace of code, that uses shared connection is synchronyzed
0
 
LVL 5

Expert Comment

by:kelfink
ID: 6848702
While synchronizing might avoid the problem, it makes the multithreading capacity pretty worthless, unless the database activity is an insignificant portion of the time spend in the thread.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8681445
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to kelfink

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question