chongsoft | 18 Nov 04:53 2013

How to drop a bad table?

I'm  using derby for 4 years, all the time I don't known how to drop a bad
table( file damaged)?

For example, if a file in "seg0" named "c20.dat" is damaged or deleted, so
the associated table "tablexxx" can not be used,and even cannot de droped
with "drop table tablexxx"(thows exceptions), can someone help me to remove
the damaged table "tablexxx"? 

View this message in context:
Sent from the Apache Derby Users mailing list archive at

Robert Glover | 14 Nov 13:04 2013

Explanation of an exception in my main thread......

Can you possibly explain where I’ve gone wrong with respect to the runtime exception error referenced below….



Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory



Thank you in advance….



Bob Glover

Robert Glover | 14 Nov 15:36 2013

error message....

Please advise concerning this error message…..



Type mismatch: cannot convert from java.sql.PreparedStatement to




Thanks in advance



Bob Glover

Pugazhal Srinivasan | 6 Nov 22:09 2013

Classloading issue in Derby function

In a application server we configure and use the Embedded derby server to register a derby function table (in EJB in our case) and are able to call the function from other places in the application, including servlet.

But we are unable to call the same function using ij. The error is "ERROR 42X51: The class 'some.class' does not exist or is inaccessible."

How to make the embedded server to remember the classloader that registered the function so that it can be called from outside the application server.


Need Support: 'SYSCS_UTIL.SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE' is not recognized as a function or procedure.

I have been trying to export a table which has BLOBs. Tables with LOBs work perfectly fine. It’s getting complicated using only java code to export / import.

It’s been few days that I am trying to export/import. I am running into only issue, and that is tables with LOBs.

Please suggest me what is going wrong. I have even tried taking latest jar files(10.5.X), currently using 10.2.X.


I am connecting to Derby as:

NetworkServerControl server = new NetworkServerControl(InetAddress.getByName("localhost"), 1527);

                  server.start(new PrintWriter(System.out));

                  connect = DriverManager.getConnection("jdbc:derby://localhost:1527/dbName");

Statement used is:

                  PreparedStatement statement = connect.prepareStatement("CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(?,?,?,?,?,?,?)");

                  statement.setString(1, null);

                  statement.setString(2, "EVENT_TRANSACTION");

                  statement.setString(3, "c:/derbytest/EVENT_TRANSACTION.csv");

                  statement.setString(4, null);

                  statement.setString(5, null);

                  statement.setString(6, null);

                  statement.setString(7, "c:/derbytest/EVENT_TRANSACTION.dat");





Here is the exception I am getting:


Exception in thread "main" java.sql.SQLException: 'SYSCS_UTIL.SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE' is not recognized as a function or procedure.


at Source)

      at Source)

      at Source)

      at com.pari.db.DerbyConnection.<init>(

      at com.pari.db.DerbyConnection.main(


Caused by: 'SYSCS_UTIL.SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE' is not recognized as a function or procedure.


at Source)

      at Source)

      at Source)

      at Source)

      at Source)

      at Source)

      at Source)

      at Source)

      at Source)

      at Source)

      at Source)

      ... 3 more


You can also call me at my mobile.


Manohar Menam

814 431 0923


Oskar Zinger | 5 Nov 17:46 2013

Upgrade from to


I'm in the process of upgrading to

Once I did the upgrade, the Derby replication no longer works. It now complains about the Databases being not in synch.

This same code was working just fine in, but does not work in

Anyone experienced this?

This is the error I'm getting:
java.sql.SQLNonTransientConnectionException: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XRE05, SQLERRMC: The log files on the master and slave are not in synch for replicated database 'ImpactDB'. The master log instant is 1:980936, whereas the sl ave log instant is 1:846980. This is fatal for replication - replication will be stopped.

Thanks for your help.

Oskar Zinger
Paul Davern | 5 Nov 15:44 2013

Execution tree metadata


I am looking at “monitoring/tracing” the resultset execution tree to
observe the tuples/records as they propagate up the tree - specifically
the calls to getNextRowCore() in BulkTableScanResultSet,
NestedLoopJoinResultSet, etc. For aggregations  I am looking at using the
SortObserver type interface.

There does not appear to be much in the way of metadata available (at
least I have not found it) in the execution tree? I am traversing the AST
tree after bind/generate to pick up some of the metadata. This is easy
enough when a column is directly associated with a base table, but, is
getting hacky otherwise. Is there a better solution? Putting something in
during the generate phase looks like a daunting task!

I realise I can use the  toXML/childrenToXML interface  to walk the
execution tree, but there does not appear to be much in the way of
metadata here.

I suppose what I am asking is, is there a direct link from the 
org.apache.derby.impl.sql.execute.ResultSet hierarchy back to the
org.apache.derby.impl.sql.compile.ResultSetNode hierarchy?


Narasimha Rao. Thangella | 31 Oct 13:28 2013

How to repair derby database

Dear Sir,

Greetings from Narasimha Rao,
I using derby database,  in that i was unable to open one table and below i am sending error msg. 
So How can I open single table/ repair table
Error msg : Error code 40000, SQL state 08006: A network protocol error was encountered and the connection has been terminated: the requested command encountered an unarchitected and implementation-specific condition for which there was no architected message
Line 1, column 1

And if you having any clarifications plz mail me or call me

Thangella. Narasimha Rao,B.E.,M.S.
Ph.No: +91-9841485432

冯之浩 | 29 Oct 04:49 2013

[SQLState: 25502]An SQL data change is not permitted for a read-only connection, user or database

In my application,I use Derby to store datas. There is an error sometimes happens during the application running.
"ERROR - An SQL data change is not permitted for a read-only connection, user or database."
It seems that the derby user has no enough privilege to write datas.But I am sure the account running the application is Administrator,and the application runs well most of time ,so I think the privilege is not the reason of the error.
And the other cause I guess is that there is no enough disk space,so the derby can't write datas from memory to disk.But I can't check the computer runs the application now.
So I need your help to tell me if any other reasons can lead into this error?
Thank you!
The detail of error/exception is here and in the attachment
[2013-10-24 08:07:47] WARN - SQL Error: 20000, SQLState: 25502
[2013-10-24 08:07:47] ERROR - An SQL data change is not permitted for a read-only connection, user or database.
Caused by: java.sql.SQLException: An SQL data change is not permitted for a read-only connection, user or database.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(
at org.hibernate.persister.entity.AbstractEntityPersister.insert(
... 54 more
Caused by: java.sql.SQLException: An SQL data change is not permitted for a read-only connection, user or database.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
... 65 more
Caused by: ERROR 25502: An SQL data change is not permitted for a read-only connection, user or database.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericAuthorizer.authorize(Unknown Source)
at org.apache.derby.impl.sql.execute.GenericResultSetFactory.getInsertResultSet(Unknown Source)
at org.apache.derby.exe.ac30c4ec5ex0141xe7b7xd10bx000000ca98b00.fillResultSet(Unknown Source)
at org.apache.derby.exe.ac30c4ec5ex0141xe7b7xd10bx000000ca98b00.execute(Unknown Source)
at org.apache.derby.impl.sql.GenericActivationHolder.execute(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
... 59 more
Best Regards
IT   Department       
TP-LINK Technologies Co.,Ltd. 
Date    2013-10-29 11:13:45
Attachment (derby.log): application/octet-stream, 8 KiB
Bob M | 23 Oct 19:48 2013

seeking explanation of SQLException error message


I have the following code
// retrieve and output date and time of oldest record from the table
rs = s.executeQuery("SELECT * FROM USD_JPY ORDER BY Date ASC, Time ASC FETCH
String Date2 = rs.getString("Date");
int Time2 = rs.getInt("Time");

myConsole.getOut().println("Date/Time: " + Date2 + ", " + Time2);

// and now delete this record.............

rs = s.executeQuery("SELECT * from USD_JPY WHERE Date = Date2 AND Time =
Time2 FOR UPDATE");;

myConsole.getOut().println("Deleted oldest record");

and the following log.............

2013-10-23 17:30:55	Message: Column 'DATE2' is either not in any table in
the FROM list or appears within a join specification and is outside the
scope of the join specification or appears in a HAVING clause and is not in
the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then
'DATE2' is not a column in the target table.
2013-10-23 17:30:55	Error Code: 20000
2013-10-23 17:30:55	SQL State: 42X04
2013-10-23 17:30:55	----- SQLException -----
2013-10-23 17:30:55	Date/Time: 01-01-2010, 0

Can somebody throw some light on what the problem might be ?

Bob M 

View this message in context:
Sent from the Apache Derby Users mailing list archive at

Bob M | 23 Oct 18:03 2013

Help with code please


With the following code........I have a problem when trying to delete the
'oldest' record

The SELECT query retrieves the correct record as shown by the output but I
can not
delete this record without a "FOR UPDATE" at the end of the SELECT query and
my current SELECT query type CAN NOT have the "FOR UPDATE" added ????
so what code modifications do I need to do ?

The sql error I am getting is...................
'deleteRow' not allowed because the ResultSet is not an updatable ResultSet

// retrieve and output date and time of oldest record from the table 
rs = s.executeQuery("SELECT * FROM tablename ORDER BY Date ASC, Time ASC
String Date2 = rs.getString("Date"); 
String Time2 = rs.getString("Time"); 

myConsole.getOut().println("Date/Time: " + Date2 + ", " + Time2); 

// and now delete this record............. 
rs = deleteRow(); 

myConsole.getOut().println("Deleted oldest record");

View this message in context:
Sent from the Apache Derby Users mailing list archive at