Bob M | 2 Dec 16:30 2013

Problem retrieving the 'oldest' record

I have code as follows:-
// 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"); 

My 4,100 records have a date range from 6 Jan 2009 to 10 Dec 2012 and a Time
range going 0, 6, 12, 18, 0 etc. 
The primary key is Date & Time fields 

i.e. the oldest record is 6 Jan 2009 / 0 
then 6 Jan 2009 / 6, 6 Jan 2009 / 12, 6 Jan 2009 / 18, 7 Jan 2009 / 0 etc. 
(Continue reading)

Bob M | 2 Dec 00:44 2013

Commiting several operations

Hi there

I am wishing to commit several add, delete, update operations, after the
following code:-

I added a single line with commit; but got an error message - and so I
clearly don't understand 'commit'

// retrieve the last record from the table
rs = s.executeQuery("SELECT * FROM USD_JPY ORDER BY Date DESC, Time DESC
String Date1 = rs.getString("Date");
String Time1 = rs.getString("Time");

myConsole.getOut().println("Date/Time: " + Date1 + ", " + Time1);

// Update this record by adding predicted return and predicted class
psUpdate = conn.prepareStatement("UPDATE USD_JPY SET

psUpdate.setDouble(1, return_current);
psUpdate.setString(2, class_current);

myConsole.getOut().println("Updated latest record with predicted return: " +
return_current + ", predicted class: " + class_current);

// add a new current record to the table
(Continue reading)

David G.P. | 30 Nov 15:49 2013

A new "Apache Derby" pronunciation.

Hello all,

I am starting to use Derby for one project, and I just saw that you are collecting pronunciations of that sentence. I just recorded one with Spanish from Spain central-northern accent (Castilla-León). I can't edit the Wiki, so how can I contribute it?

Thanks for all your work and I hope I can contribute more soon.
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