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

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 https://db.apache.org/derby/docs/10.4/adminguide/tadminnetservcustom.html.)

 

To run the Derby network server on Windows, you will need to download a copy of the server policy file 1010_server.policy from https://issues.apache.org/jira/browse/DERBY-6438 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-10.10.1.1-bin.  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-10.10.1.1-bin/lib/derby.jar"

     grant codeBase "file:/C:/Java/db-derby-10.10.1.1-bin/lib/derby.jar"

     grant codeBase "file:///C:/Java/db-derby-10.10.1.1-bin/lib/derby.jar"

but not

     grant codeBase "file://C:/Java/db-derby-10.10.1.1-bin/lib/derby.jar"

 

This is an important point since the sample files in the Derby Developer's Guide seem to imply that two slashes are acceptable – see http://db.apache.org/derby/docs/10.10/devguide/cdevcsecure871387.html.  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")

java.security.AccessControlException: access denied ("java.util.PropertyPermission" "derby.__serverStartedFromCmdLine" "write")

        at java.security.AccessControlContext.checkPermission(Unknown Source)

        at java.security.AccessController.checkPermission(Unknown Source)

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

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

        at org.apache.derby.drda.NetworkServerControl$1.run(Unknown Source)

        at org.apache.derby.drda.NetworkServerControl$1.run(Unknown Source)

        at java.security.AccessController.doPrivileged(Native Method)

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

        at org.apache.derby.iapi.tools.run.main(Unknown Source)

 

You also need to replace “${derby.security.port}” with the appropriate port number (e.g., 1527).   Alternatively, you can define “${derby.security.port}” in your call to start the Derby network server, as in “-Dderby.security.port=1527”.  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% -Dderby.security.port=1527 -Djava.security.manager -Djava.security.policy=%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% -Dderby.security.port=1527 -Djava.security.manager -Djava.security.policy=%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
Picon

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

AirDT

--
View this message in context: http://apache-database.10148.n7.nabble.com/How-know-databases-connected-with-Derby-networkServer-tp136724.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Paul Linehan | 23 Jan 20:41 2014
Picon
Picon

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
00:00:00','RNASeqGene',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)

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

========
COLUMN_NAME         |TYPE_NAME|DEC&|NUM&|COLUM&|COLUMN_DEF|CHAR_OCTE&|IS_NULL&
------------------------------------------------------------------------------
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 http://db.apache.org/derby/docs/10.5/ref/rrefsqlj27620.html,
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,

Paul...

--

-- 

linehanp@...

Mob: 00 353 86 864 5772

Paul Linehan | 21 Jan 15:09 2014
Picon
Picon

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
http://db.apache.org/derby/docs/10.0/manuals/reference/sqlj27.html#CREATE+TABLE+statement,
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"
in the CREATE TABLE
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,

Paul...

--

-- 

linehanp@...

Mob: 00 353 86 864 5772

Paolo Forte | 17 Jan 17:26 2014
Picon

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

Hi,

 

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 "service.properties" 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

 

By

 

Paolo Forte

 

PRODUCTION GROUP SRL

( Office  +39 0823 821641

7 Fax     +39 0823 821325

* E-mail: pforte <at> productionspa.it

 

“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
Picon

Multiple Derby Network Server instances on a same computer

Hi

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

AirDT

--
View this message in context: http://apache-database.10148.n7.nabble.com/Multiple-Derby-Network-Server-instances-on-a-same-computer-tp136584.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

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

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.

 

C:\Java\db-derby-10.10.1.1-bin\bin>startNetworkServer.bat

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 ("java.net.SocketPermission" "localhost:1527" "listen,resolve")

java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve")

        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)

        at java.security.AccessController.checkPermission(AccessController.java:559)

        at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)

        at java.lang.SecurityManager.checkListen(SecurityManager.java:1134)

        at java.net.ServerSocket.bind(ServerSocket.java:375)

        at java.net.ServerSocket.<init>(ServerSocket.java:237)

        at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)

        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$1.run(Unknown Source)

        at org.apache.derby.impl.drda.NetworkServerControlImpl$1.run(Unknown Source)

        at java.security.AccessController.doPrivileged(Native 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
Picon

Derby in production environment

Hello, 

I want to use Derby in a production environment and I read the following
sentence: 
"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 
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fah35004_.htm

Is Derby currently being used successfully in production environments?

Any information would be appreciated. Thanks in advance.

AirDT

--
View this message in context: http://apache-database.10148.n7.nabble.com/Derby-in-production-environment-tp136557.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Bob M | 11 Jan 20:20 2014
Picon

Exporting table records

Hi

I have a derby database with one table which I access using Netbeans

What is an easist way for me to export the contents of the table ?

Bob M

--
View this message in context: http://apache-database.10148.n7.nabble.com/Exporting-table-records-tp136465.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Han Xin | 10 Jan 19:59 2014
Picon

Can I run derby for a long time?

Can I run derby for a long time with many inserts, deletes and updates? Are the memories, disk spaces recovered after deletion/updating?

Any information would be appreciated. Thanks in advance.
Melissa Mifsud | 10 Jan 05:40 2014
Picon

Setting derby.storage.pageSize

Version: 10.10.1.1 (Embedded)

I have been trying to set the derby.storage.pageSize on an index according to http://db.apache.org/derby/docs/10.10/ref/rrefproper40688.html in the hope that increasing the pageSize will help with a large insert/update.

It seems the value doesn't seem to be changing. The relevant part of my script is:

call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize','16384'); 
-- CREATE TABLE DataSource...
CREATE INDEX dataSource_path_idx ON DataSource(connectorId, path);
select p, syscs_util.syscs_get_database_property(p) from (values 'derby.storage.pageCacheSize', 'derby.storage.pageSize') props(p); 
call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '4096');
select p, syscs_util.syscs_get_database_property(p) from (values 'derby.storage.pageCacheSize', 'derby.storage.pageSize') props(p); 


Both selects give the same output:
P                                         |2                                                                                                                               
-----------------------------------------------------------------------------------
derby.storage.pageCacheSize               |4000                                                                                               
derby.storage.pageSize                    |NULL    


So I have (earlier in the script) changed the pageCacheSize property using SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY but the pageSize does not change.
Running select pagesize from table (syscs_diag.space_table('APP', 'DataSource')) s; returns no rows.
  1. Is there a way to check what the pageSize of an index is?
  2. Is there some other way I should be setting the pageSize property?

Thanks,
Melissa




Gmane