db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexandre Borgoltz (JIRA)" <j...@apache.org>
Subject [jira] Created: (DDLUTILS-29) "Stream is already closed" with Oracle
Date Wed, 12 Oct 2005 14:12:06 GMT
"Stream is already closed" with Oracle

         Key: DDLUTILS-29
         URL: http://issues.apache.org/jira/browse/DDLUTILS-29
     Project: DdlUtils
        Type: Bug
 Environment: Using oracle10g jdbc client driver  with oracle 8i server
    Reporter: Alexandre Borgoltz
 Assigned to: Thomas Dudziak 

I get a SQLException stating that the "stream is already closed".
It occurs in at org.apache.ddlutils.io.JdbcModelReader.getValueAsString
for the "COLUMN_DEF" column.

Here is the stack trace - as you can see, I am using the ant task, with the sample xml provided
on DdlUtils' site.

java.sql.SQLException: Le flux de données est déjà fermé
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
at oracle.jdbc.driver.LongAccessor.getBytes(LongAccessor.java:166)
at oracle.jdbc.driver.LongAccessor.getString(LongAccessor.java:207)
at oracle.jdbc.driver.T4CLongAccessor.getString(T4CLongAccessor.java:390)
at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:355)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1559)
at org.apache.ddlutils.io.JdbcModelReader.getValueAsString(JdbcModelReader.java:494)
at org.apache.ddlutils.io.JdbcModelReader.getColumnsForTable(JdbcModelReader.java:277)
at org.apache.ddlutils.io.JdbcModelReader.getTables(JdbcModelReader.java:205)
at org.apache.ddlutils.io.JdbcModelReader.getDatabase(JdbcModelReader.java:140)
at org.apache.ddlutils.task.DatabaseToDdlTask.readSchema(DatabaseToDdlTask.java:194)
at org.apache.ddlutils.task.DatabaseToDdlTask.execute(DatabaseToDdlTask.java:214)

I have tested it with 8i, 9i and 10g versions of the client oracle driver - same result.

It highly looks like this is a bug in oracle's drivers management of Long fields. 

My tests proved that resultset.getString("COLUMN_DEF") :
+can't be called twice (if .next() is not called obviously)
+always fails for primary fields with 9i- drivers
+fails if called after e.g. .getString("IS_NULLABLE") with 10g drivers
+works OK if called first *with 10g drivers*

So what I did is modify
JdbcModelReader.getColumnsForTable(DatabaseMetaData, String)
and move the call of
getValueAsString(..., "COLUMN_DEF", ...)
to be the first one called. This works perfectly on my platform now.

I'll attach the corresponding patch

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message