Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 82578C792 for ; Tue, 18 Jun 2013 12:11:21 +0000 (UTC) Received: (qmail 76739 invoked by uid 500); 18 Jun 2013 12:11:21 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 76668 invoked by uid 500); 18 Jun 2013 12:11:21 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 76218 invoked by uid 99); 18 Jun 2013 12:11:20 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jun 2013 12:11:20 +0000 Date: Tue, 18 Jun 2013 12:11:20 +0000 (UTC) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DERBY-6265) Opening a read-only database fails: "Container was opened in read-only mode" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-6265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13686629#comment-13686629 ] Rick Hillegas commented on DERBY-6265: -------------------------------------- You should be able to set derby.database.defaultConnectionMode as a system property, according to the summary table in http://db.apache.org/derby/docs/10.10/ref/crefproper22250.html. Thanks. > Opening a read-only database fails: "Container was opened in read-only mode" > ---------------------------------------------------------------------------- > > Key: DERBY-6265 > URL: https://issues.apache.org/jira/browse/DERBY-6265 > Project: Derby > Issue Type: Bug > Components: JDBC > Affects Versions: 10.9.1.0, 10.10.1.1 > Environment: Windows 8 64-bit > Reporter: Trejkaz > > I created a read-only database by taking an existing database and then using Windows to set the directory (which really means the files) to read-only. > Opening the database now results in the following error: > {noformat} > java.sql.SQLException: Failed to start database 'C:\Cases\Read-only\Stores\AnalysisDatabase' with class loader sun.misc.Launcher$AppClassLoader@893886b, see the next exception for details. > at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) > at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) > at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedConnection.(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedConnection40.(Unknown Source) > at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source) > at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) > at org.apache.derby.jdbc.EmbeddedBaseDataSource.getConnection(Unknown Source) > at org.apache.derby.jdbc.EmbedPooledConnection.openRealConnection(Unknown Source) > at org.apache.derby.jdbc.EmbedPooledConnection.(Unknown Source) > at org.apache.derby.jdbc.EmbedPooledConnection40.(Unknown Source) > at org.apache.derby.jdbc.Driver40.getNewPooledConnection(Unknown Source) > at org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.createPooledConnection(Unknown Source) > at org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.getPooledConnection(Unknown Source) > at com.acme.sql.ConnectionPoolManager$PooledConnectionFactory.makeObject(ConnectionPoolManager.java:218) > at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:974) > at com.acme.sql.ConnectionPoolManager.getConnection(ConnectionPoolManager.java:93) > at com.acme.storage.database.AbstractPooledDatabase.(AbstractPooledDatabase.java:66) > ... 17 more > Caused by: java.sql.SQLException: Failed to start database 'C:\Cases\Read-only\Stores\AnalysisDatabase' with class loader sun.misc.Launcher$AppClassLoader@893886b, see the next exception for details. > at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) > at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) > ... 36 more > Caused by: java.sql.SQLException: Container was opened in read-only mode. > at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) > at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) > at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) > at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) > ... 33 more > Caused by: ERROR 40XD1: Container was opened in read-only mode. > at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) > at org.apache.derby.impl.store.raw.data.BaseContainer.use(Unknown Source) > at org.apache.derby.impl.store.raw.data.BaseContainerHandle.useContainer(Unknown Source) > at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown Source) > at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown Source) > at org.apache.derby.impl.store.raw.xact.Xact.openContainer(Unknown Source) > at org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.init(Unknown Source) > at org.apache.derby.impl.store.access.heap.Heap.openScan(Unknown Source) > at org.apache.derby.impl.store.access.RAMTransaction.openScan(Unknown Source) > at org.apache.derby.impl.store.access.RAMTransaction.openScan(Unknown Source) > at org.apache.derby.impl.store.access.PropertyConglomerate.openScan(Unknown Source) > at org.apache.derby.impl.store.access.PropertyConglomerate.saveProperty(Unknown Source) > at org.apache.derby.impl.store.access.PropertyConglomerate.setProperty(Unknown Source) > at org.apache.derby.impl.store.access.RAMTransaction.setProperty(Unknown Source) > at org.apache.derby.impl.sql.catalog.DD_Version.applySafeChanges(Unknown Source) > at org.apache.derby.impl.sql.catalog.DD_Version.upgradeIfNeeded(Unknown Source) > at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.loadDictionaryTables(Unknown Source) > at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.boot(Unknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) > at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source) > at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source) > at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) > at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown Source) > at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown Source) > at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown Source) > ... 33 more > {noformat} > Behaviour under 10.9.1.0 is somewhat different but still undesirable. The database successfully opens, but connection.isReadOnly() returns false. Our application code then attempts to modify the database itself, resulting in the same error above (just at a different point in the application lifecycle.) > The last time I tested the read-only support was reading databases from optical disks which is "true" read-only, but maybe this kind of read-only database just isn't detected properly when the database is being opened? > Even in the case of a read-only database, the only error I would ever expect to see is: "An SQL data change is not permitted for a read-only connection, user or database". I would only expect to see this when I actually make changes to the database and of course, connection.isReadOnly() should return false so that I don't try to. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira