db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: "ERROR 40XD1: Container was opened in read-only mode" when performing SELECT DISTINCT on database in jar
Date Mon, 19 Feb 2007 15:21:59 GMT
Thomas Kelder wrote:
> Stanley Bradbury wrote:
>>> Hi Thomas -
>>> I looked into this further after I discovered inconsistencies in our
>>> documentation and it making the change I suggested will not correct
>>> your problem (though I still believe that Static properties need to be
>>> set prior to loading the driver).  I am looking into this further but
>>> it looks like a bug so far.  Thank you for reporting this and
>>> supplying the easy to use test case.  I will let you know what I find.
>>> Stan
>> This appears to be a bug, possibly a regression.  When I converted your
>> DB to10.0 everything worked fine even when I did NOT set the properties
>> for tempDirectory and error.file (hmmm..).  When I switched to using the
>> 10.1  or 10.2 jars and accessed the very same database the 40XD1 ERROR
>> happened.
>> Since this is your discovery it is only right that you should file (e.g.
>> get credit for) the JIRA bug report.  The instructions for doing this
>> are at:
>>   http://db.apache.org/derby/DerbyBugGuidelines.html
>>  there is a document linked to this page that steps you through the
>> process with screenshots.
>> Please attach your DB and java program, include the link to this email
>> thread (http://article.gmane.org/gmane.comp.apache.db.derby.user/6123)
>> and make note of the findings that this does happen using version 10.0.
>> As I mentioned earlier - our documentation of tempDirectory is
>> inconsistent and I will be filing a doc bug for that.  The PROPERTIES
>> table in the Tuning guide lists this as a Dynamic property whereas the
>> descriptive text of the property says it is Static - my guess is that it
>> is static but someone will have to look into the code to tell for sure.
> Hi Stan,
> Thanks for your support, I filed a bug on JIRA as you advised:
> https://issues.apache.org/jira/browse/DERBY-2354
> Considering the static properties, do you know a way to set a static
> property from within the java program before loading the driver (so
> without using the derby.properties file or a command-line option)? The
> only option I could find in the documentation to set the properties
> programatically was to use a Properties object when calling
> DriverManager.getConnection, but this requires the driver to be loaded
> first.
> Thanks,
> Thomas
Hi Thomas -

This is how I modified your program for my tests.   Base on the example at:


import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

public class DerbyTest2 {

    public static void main(String[] args) {
        File dbFile = new File("testdb.zip");

        Properties sprop = System.getProperties();
        sprop.put("derby.storage.tempDirectory", "C:\\temp");
        sprop.put("derby.stream.error.file", "C:\\temp\\derby.log");

        try {
        } catch (ClassNotFoundException e) {
            System.out.println("Derby driver not found!");
        String url = "jdbc:derby:jar:(" + dbFile.toString() + ")database";
        try {
            Connection con = DriverManager.getConnection(url);
            Statement s = con.createStatement();
            s.executeQuery("SELECT DISTINCT groupId FROM expression");
        } catch (SQLException e) {


View raw message