Paul Linehan | 1 Feb 21:14 2014

How to log queries in Apache Derby?

Hi all,

I am trying to log queries to my Apache Derby server.

My $DERBY_HOME is as follows - Ubuntu Linux 64bit - Java jdk1.7.0_45.
Can access my database through Squirrel and ij.

linehanp <at> lg12l9:~/derby/db-derby-$ echo $DERBY_HOME
linehanp <at> lg12l9:~/derby/db-derby-$

I launch derby by issuing the command (from $DERBY_HOME)

java -jar $DERBY_HOME/lib/derbyrun.jar server start
or sometimes

I created a file called in $DERBY_HOME/bin
in which there is one line

linehanp <at> lg12l9:~/derby/db-derby-$ more
linehanp <at> lg12l9:~/derby/db-derby-$

Restart server.

(Continue reading)

Paul Linehan | 1 Feb 17:35 2014

Can't open more than one connection to database?

Hi all,

A curious one is happening today.

I normally connect to derby using either ij or SQuirreL SQL
or both.

Today though, if I connect with Squirrel, I can't connect with ij
and vice versa.

Error is here
linehanp <at> lg12l9:~/derby/db-derby-$ ij
ij version 10.10
ij>  CONNECT 'jdbc:derby:firstdb';
ERROR XJ040: Failed to start database 'firstdb' with class loader
sun.misc.Launcher$AppClassLoader <at> 591ce4fe, see the next exception for
ERROR XSDB6: Another instance of Derby may have already booted the
database /users/ugrad/linehanp/derby/db-derby-

I'm using the Client/Server version - and I'm *_almost_* certain this
didn't happen before.

Any ideas?

TIA and rgs,

(Continue reading)

Amitava Kundu1 | 30 Jan 07:46 2014

Issue with large delete in derby

We are using embedded derby in our product, This derby database is
used as regular RDBMS where lot of insert, delete and select happens, There
are business entities each of its occurrence could be of size 10 GB and
upward e.g. a huge log file data.
In our application, we use cascade delete and also has referential
integrity constraints ON.

This application runs on 64 bit Linux with 8 GB RAM allocated to JVM.
Similar time is observed in our development Windows box.

 It takes more than 3 hour to delete those entities. During this time all
the relevant tables stay locked and no other operation is feasible.

We'd like know what could be different options/ strategy be adopted for:
   Speeding up the delete process
   Ability to other database activities in parallel

	Amitava Kundu

John I. Moore, Jr. | 30 Jan 15:27 2014

Configuring a Server Policy for Derby on Windows

I am sending this email to the Derby user list with the hope that I can save someone time and frustration when trying to run the Derby network server on Windows with the latest version of Java (currently 1.7.0_51).  With the latest version of Java, it is no longer possible to use the batch file “startNetworkServer.bat” to start the network server.  If you run derby under Linux or some variation of Unix, or if you are already familiar with how to use a server policy file with Derby, you can probably ignore this message.  (Note to Derby developers:  You might want to add some of the descriptions below to the appropriate pages in the Derby documentation, especially


To run the Derby network server on Windows, you will need to download a copy of the server policy file 1010_server.policy from and edit it for your use or define appropriate system properties when starting the Derby network server.  I will give an example for editing the file.


When editing the file, replace “${derby.install.url}” with the full path name for the Derby jar files in the four sections that start with “grant codebase”.  The syntax is a little tricky.  For example, assume that derby has been installed in C:\Java\db-derby-  You use a “file:” specification, but you need to use forward slashes, not back slashes.  Also, the file specification can contain zero, one, or three forward slashes, but not two.  Thus, any of the following will work

     grant codeBase "file:C:/Java/db-derby-"

     grant codeBase "file:/C:/Java/db-derby-"

     grant codeBase "file:///C:/Java/db-derby-"

but not

     grant codeBase "file://C:/Java/db-derby-"


This is an important point since the sample files in the Derby Developer's Guide seem to imply that two slashes are acceptable – see  If you use two slashes in you file specification, you will get an error message similar to the following:


Thu Jan 30 09:09:33 EST 2014 : access denied ("java.util.PropertyPermission" "derby.__serverStartedFromCmdLine" "write") access denied ("java.util.PropertyPermission" "derby.__serverStartedFromCmdLine" "write")

        at Source)

        at Source)

        at java.lang.SecurityManager.checkPermission(Unknown Source)

        at java.lang.System.setProperty(Unknown Source)

        at org.apache.derby.drda.NetworkServerControl$ Source)

        at org.apache.derby.drda.NetworkServerControl$ Source)

        at Method)

        at org.apache.derby.drda.NetworkServerControl.main(Unknown Source)

        at Source)


You also need to replace “${}” with the appropriate port number (e.g., 1527).   Alternatively, you can define “${}” in your call to start the Derby network server, as in “”.  Other policy file parameters can be handled similarly, but these are the most important ones, and these changes are the minimum needed to get the Derby network server started.


I saved the policy file in my DERBY_HOME directory as simply server.policy, and I edited only the four “grant codebase” sections as described above.  I can then start the Derby network server using a command similar to the following (which I placed in a batch file):

start java -Dderby.system.home=%DERBY_HOME%\server.policy -jar %DERBY_HOME%\lib\derbyrun.jar server start


Alternatively, if your class path contains the appropriate Derby jar files (which can ensure by running %DERBY_HOME%\bin\setNetworkServerCP.bat), you can start the Derby network server using the following:

start java -Dderby.system.home=%DERBY_HOME%\server.policy org.apache.derby.drda.NetworkServerControl start


I hope this helps.  I wasted a lot of time before I figured out that the two forward slashes in the file specification was causing the problem.




John I. Moore, Jr.

SoftMoore Consulting


AirDT | 24 Jan 11:32 2014

How know databases connected with Derby networkServer

Hello everyone, 

I run a NetworkServer that allows multiple users to connect to multiple
Derby database. 
How do I know databases connected at a given moment ?
In order to :
- Have knowledge of potential users connected to each connected dataBase
- Shutdown these databases in order to remove them without shutDown derby. 

Any help would be appreciated.
Thanks in advance


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

Paul Linehan | 23 Jan 20:41 2014

Migrating from MySQL to Apache - having difficulty with Timestamp.

Hi all,

I have the following MySQL statement and I wish to insert the same
data into a Derby table.

INSERT INTO analysis VALUES (6,'0000-00-00

My Derby table is of the fomat (some columns missing).

ANALYSIS_ID         |SMALLINT |0   |10  |5     |NULL      |NULL      |NO
CREATED             |TIMESTAMP|9   |10  |29    |NULL      |NULL      |NO
LOGIC_NAME          |VARCHAR  |NULL|NULL|128   |NULL      |256       |NO
DB                  |VARCHAR  |NULL|NULL|120   |NULL      |240       |YES
DB_VERSION          |VARCHAR  |NULL|NULL|40    |NULL      |80        |YES
DB_FILE             |VARCHAR  |NULL|NULL|120   |NULL      |240       |YES
PROGRAM             |VARCHAR  |NULL|NULL|80    |NULL      |160       |YES

From here,
is *_appears_* that
my data is OK, but I get the error
Error: The string representation of a date/time value is out of range.
SQLState:  22007
ErrorCode: 30000

From Squirrel SQL.

Could anybody kindly point out where I'm going wrong?

TIA and rgs,





Mob: 00 353 86 864 5772

Paul Linehan | 21 Jan 15:09 2014

Creating tables - migrating from MySQL.

Hi all,

I'm trying to migrate a system (72 tables) from MySQL to Apache.

I've looked at the docco here,
but it isn't readily apparent to me how to create INDEXES within the
CREATE TABLE statement.

I'd rather not have to manually perform this procedure - a sample might help.

CREATE TABLE analysis (
  analysis_id smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  created datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  logic_name varchar(128) NOT NULL,
  db varchar(120) DEFAULT NULL,
  PRIMARY KEY (analysis_id),
  UNIQUE KEY logic_name_idx (logic_name),
  KEY db_idx (db)

Tried this through ij and it failed.

What do I have to substitute for "PRIMARY KEY", "UNIQUE KEY" and "KEY"
statement (I'll either use sed/awk/vi/ or Java eventually) - or do I
have to create the PRIMARY KEY
and other KEYs outside of the main CREATE TABLE statement?

I did try doing this automatically using SQuirrel SQL, but there are
(MySQL!!!) some fields called
"end".... I'll try and quote these with double quotes for the time being.

Any help, ideas, references, URLs & appreciated.

TIA and rgs,





Mob: 00 353 86 864 5772

Paolo Forte | 17 Jan 17:26 2014

read from a Derby db with only "SEQ0" forlder and "" file



I’m Paolo Forte,sorry for my bad English;


I’m not a developer but there is an application software in my farm that use Derby Db;


The pc is crashed but I have a copy of “seq0” folder and "" file;


The db under application software is ok but for some settings it doesn’t work sometime;


Is there any method to read from the db like sql, I tried with Razorsql but there is not driver to work with it, it display a message that the verion NULL cannot upgrade to version 10.5;


Please, I cannot loose this db because there’s 5 months of my collegue works on this db;


Very Thanks




Paolo Forte



( Office  +39 0823 821641

7 Fax     +39 0823 821325

* E-mail: pforte <at>


“Le informazioni e i contenuti di questa email hanno carattere riservato e sono indirizzate esclusivamente al destinatario. Nel caso di erronea trasmissione Vi invitiamo, ai  sensi del Dlg. 196/2003 (Legge sulla Privacy), a dare comunicazione dell'errato ricevimento all'indirizzo e-mail del mittente, nonchè a provvedere alla distruzione del documento erroneamente ricevuto.

Il mittente non è responsabile per i dati comunicati e conosciuti contravvenendo a questo invito”

"The information and content of this email are confidential and addressed only to the recipient. In case of erroneous transmission we invite you, pursuant to Dlg. 196/2003 (Privacy Act), to give notice of the incorrect receipt to the email address of the sender, as well as to ensure the destruction of the document received erroneously. The sender is not responsible for information communicated and known in contravention to this request.."



AirDT | 17 Jan 16:41 2014

Multiple Derby Network Server instances on a same computer


1 - Is it possible to run multiple Derby Network Server instances on a same
computer? (each one with a different port and a different system derby
directory) ? 
2 - Can I do it in a single thread or should I use separate threads ? 
3 - Is there a maximum number of databases on witch  users can connect with
a given Derby Network Server ? 
4 - When there are no more connected users to a database is it possible to
automatically shutdown the database ?

Thanks in advance


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

John I. Moore, Jr. | 17 Jan 16:23 2014

Network Server Access Permissions and Java 1.7.0_51

Java version 1.7.0_51 (latest version) causes the following error when trying to start the network server.  I can see from the issue tracker that there is a fix to be added that should correct this problem in the next release, but is there an easy workaround that exists now?  Details would be appreciated.




John I. Moore, Jr.



Thu Jan 16 16:34:04 EST 2014 : Security manager installed using the Basic server security policy.

Thu Jan 16 16:34:04 EST 2014 : access denied ("" "localhost:1527" "listen,resolve") access denied ("" "localhost:1527" "listen,resolve")



        at java.lang.SecurityManager.checkPermission(

        at java.lang.SecurityManager.checkListen(




        at org.apache.derby.impl.drda.NetworkServerControlImpl.createServerSocket(Unknown Source)

        at org.apache.derby.impl.drda.NetworkServerControlImpl.access$000(Unknown Source)

        at org.apache.derby.impl.drda.NetworkServerControlImpl$ Source)

        at org.apache.derby.impl.drda.NetworkServerControlImpl$ Source)

        at Method)

        at org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown Source)

        at org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(Unknown Source)

        at org.apache.derby.drda.NetworkServerControl.main(Unknown Source)


AirDT | 16 Jan 15:41 2014

Derby in production environment


I want to use Derby in a production environment and I read the following
"The Derby database Has No Associated security controls, and no
optimizations-have-been performed. Reasons For thesis, do not use Derby in a
Production environment." 
in doc

Is Derby currently being used successfully in production environments?

Any information would be appreciated. Thanks in advance.


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