db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mamta Satoor <msat...@gmail.com>
Subject In memory db and usage of file system apis
Date Fri, 31 Jan 2014 23:18:10 GMT
Hi,

I am not familiar with Derby's in memory db implementation (accessed
through jdbc url jdbc:derby:memory:... ) but I thought there will not be
any file system access for such a db. But when I tried a long dbname with
such a url, I got the exception(the complete stack trace is at the bottom
of this email.) "Caused by: java.sql.SQLException: Java exception: 'The
parameter is incorrect.: java.io.IOException'. The url I tried is
'jdbc:derby:memory:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;create=true';

I am copying a little part of the long stack trace to show that exception
is being thrown by windows system api(I am trying this on a Windows 7
machine)
Caused by: java.io.IOException: The parameter is incorrect.
        at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:407)
        at java.io.File.getCanonicalPath(File.java:570)
        at
org.apache.derby.impl.io.VFMemoryStorageFactory.init(VFMemoryStorageFactory.java:109)

The java comment for VFMemoryStorageFactory.init is as follows. It looks
like we are accessing the file system to make sure there is no such dbname
already existing in the file system. Should we be catching 'The parameter
is incorrect.: java.io.IOException' in this code and if we get this
exception, then we can assume that there is no physical db with the same
name and hence we can go ahead and create in memory db. Appreciate all the
help. Thanks

    /**
     * Initializes the storage factory instance by setting up a temporary
     * directory, the database directory and checking if the database being
     * named already exists.
     *
     * @param home the value of {@code system.home} for this storage factory
     * @param databaseName the name of the database, all relative pathnames
are
     *      relative to this name
     * @param tempDirNameIgnored ignored
     * @param uniqueName used to determine when the temporary directory can
be
     *      created, but not to name the temporary directory itself
     *
     * @exception IOException on an error (unexpected).
     */


Here is the complete stack trace
ERROR XJ040: Failed to start database
'memory:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
with class loader sun.misc.Launcher$AppClassLoader@53745374, see the next
exception for details.
java.sql.SQLException: Failed to start database
'memory:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
with class loader sun.misc.Launcher$AppClassLoader@53745374, see the next
exception for details.
        at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:103)
        at
org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:137)
        at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:310)
        at
org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2842)
        at
org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:405)
        at
org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(InternalDriver.java:628)
        at
org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:282)
        at
org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:913)
        at
org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:147)
        at java.sql.DriverManager.getConnection(DriverManager.java:419)
        at java.sql.DriverManager.getConnection(DriverManager.java:391)
        at org.apache.derby.impl.tools.ij.ij.dynamicConnection(ij.java:1483)
        at org.apache.derby.impl.tools.ij.ij.ConnectStatement(ij.java:1313)
        at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:1101)
        at
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:347)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:245)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
        at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
        at org.apache.derby.tools.ij.main(ij.java:59)
Caused by: java.sql.SQLException: Failed to start database
'memory:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
with class loader sun.misc.Launcher$AppClassLoader@53745374, see the next
exception for details.
        at
org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory.java:138)
        at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:73)
        ... 19 more
Caused by: java.sql.SQLException: Java exception: 'The parameter is
incorrect.: java.io.IOException'.
        at
org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory.java:138)
        at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:73)
        at
org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:137)
        at org.apache.derby.impl.jdbc.Util.javaException(Util.java:331)
        at
org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2838)
        ... 16 more
Caused by: java.io.IOException: The parameter is incorrect.
        at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:407)
        at java.io.File.getCanonicalPath(File.java:570)
        at
org.apache.derby.impl.io.VFMemoryStorageFactory.init(VFMemoryStorageFactory.java:109)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService.privGetStorageFactoryInstance(StorageFactoryService.java:215)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService.access$400(StorageFactoryService.java:71)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService$12.run(StorageFactoryService.java:958)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService$12.run(StorageFactoryService.java:954)
        at
java.security.AccessController.doPrivileged(AccessController.java:327)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService.getCanonicalServiceName(StorageFactoryService.java:952)
        at
org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1504)
        at
org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:988)
        at
org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:546)
        at
org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2803)
        ... 16 more
ERROR XJ001: Java exception: 'The parameter is incorrect.:
java.io.IOException'.
java.sql.SQLException: Java exception: 'The parameter is incorrect.:
java.io.IOException'.
        at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:103)
        at
org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:137)
        at org.apache.derby.impl.jdbc.Util.javaException(Util.java:331)
        at
org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2838)
        at
org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:405)
        at
org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(InternalDriver.java:628)
        at
org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:282)
        at
org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:913)
        at
org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:147)
        at java.sql.DriverManager.getConnection(DriverManager.java:419)
        at java.sql.DriverManager.getConnection(DriverManager.java:391)
        at org.apache.derby.impl.tools.ij.ij.dynamicConnection(ij.java:1483)
        at org.apache.derby.impl.tools.ij.ij.ConnectStatement(ij.java:1313)
        at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:1101)
        at
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:347)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:245)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
        at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
        at org.apache.derby.tools.ij.main(ij.java:59)
Caused by: java.sql.SQLException: Java exception: 'The parameter is
incorrect.: java.io.IOException'.
        at
org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory.java:138)
        at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:73)
        ... 19 more
Caused by: java.io.IOException: The parameter is incorrect.
        at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:407)
        at java.io.File.getCanonicalPath(File.java:570)
        at
org.apache.derby.impl.io.VFMemoryStorageFactory.init(VFMemoryStorageFactory.java:109)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService.privGetStorageFactoryInstance(StorageFactoryService.java:215)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService.access$400(StorageFactoryService.java:71)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService$12.run(StorageFactoryService.java:958)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService$12.run(StorageFactoryService.java:954)
        at
java.security.AccessController.doPrivileged(AccessController.java:327)
        at
org.apache.derby.impl.services.monitor.StorageFactoryService.getCanonicalServiceName(StorageFactoryService.java:952)
        at
org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1504)
        at
org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:988)
        at
org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:546)
        at
org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2803)
        ... 16 more

Mime
View raw message