Robert:
Thank you for your quick response. I'm attaching a standalone test that
we've developed to replicate the protocol violation messages we see in
Squirrel sessions. It uses pure JDBC and a set of threads attempting to
share a DatabaseMetaData reference. It fails, almost invariably,
irrespective of which JDK and Oracle JDBC driver versions we try
(including the 10g version).
Funny thing is, we do have a DBA who is trying to help us analyze the
problem. As I mentioned, it's been an arduous task to replicate the
problem. However, I wish to clarify myself. The problem with our
database going down doesn't have a confirmed direct correlation to the
problem we are discussing here. =20
However, I am still interested in finding out if Squirrel is using the
JDBC API in a way that will generate unpredictable results. As
developers use Squirrel SQL with the code completion plugin against
Oracle database instances, we get SQLExceptions with messages "Protocol
Violation", "Maximum data type length exceeded", and "Connection is
closed" pretty regularly as we work with the SQL editor.
Thank you for your help,
Amit
-----Original Message-----
From: Rob Manning [mailto:Rob...@co...]=20
Sent: Friday, October 07, 2005 2:39 PM
To: Gollapudi, Amit C. (STL)
Cc: squ...@li...
Subject: Re: [Squirrel-sql-develop] DatabaseMetaData & Thread Safety
Gollapudi, Amit C. (STL) wrote:
> Hi,
>
> Our development team uses Squirrel SQL to work mostly with Oracle
> databases. Recently, however, we've been running into problems. =20
> After spending a lot of time trying to understand and reproduce the=20
> problems, we've narrowed the symptoms.=20
>
> SchemaInfo's loadColumns method gets triggered from a few places. Of
> interest, however, is the code completion plugin. The plugin seems to
> trigger the loadColumns on key strokes. That is all and well. But,=20
> loadColumns uses a class instance variable reference to=20
> DatabaseMetaData to grab column information about the table being=20
> worked on.=20
>
> Now, with Oracle's JDBC drivers, having DatabaseMetaData accessed from
> multiple threads is inherently problematic. It causes some problems=20
> that, under the right load, take the entire database down. As=20
> disappointing as all that is, the question is whether SchemaInfo is=20
> right in making the assumption that JDBC drivers will provide a=20
> thread-safe DatabaseMetaData object.
>
> Thoughts, suggestions?
>
I've recently decompiled the Oracle 10g JDBC driver and I notice that
oracle.jdbc.driver.OracleDatabaseMetaData has the following signature=20
for getColumns:
public synchronized ResultSet getColumns(String s, String s1, String
s2, String s3)
throws SQLException
=20
Since it's synchronized, multiple threads cannot be in here at the same=20
time. I've noticed in
the past that most public JDBC API methods in the Oracle drivers are=20
synchronized using the
instance monitor. So, while that's a huge performance bottleneck if you
aren't careful, I don't
see that concurrent access is going to cause trouble. I've personally=20
seen hundreds of threads
sharing access to a single pool of PreparedStatements allocated from a=20
single Connection
without any difficulty on the client. I don't see how this could "take=20
the entire database down".
I'm not a DBA, but one might be useful in determining what statement(s)=20
are hogging the CPU/IO
on your Oracle server.
Rob
CollabraSpace - Revolutionary Collaboration
Visit us at http://www.collabraspace.com
This message has been scanned for viruses by
ClamAV v0.83
******* Confidentiality Notice *******
This email, its electronic document attachments, and the contents of its =
website linkages may contain confidential health information. This =
information is intended solely for use by the individual or entity to =
whom it is addressed. If you have received this information in error, =
please notify the sender immediately and arrange for the prompt =
destruction of the material and any accompanying attachments.
|