db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mamta Satoor <msat...@gmail.com>
Subject Re: In memory db and usage of file system apis
Date Tue, 04 Feb 2014 17:59:00 GMT
Hi Rick,

Thanks for responding to my email. You are correct about differences in
legal length limit on filename on various file systems and that is why it
will be nice to write the test with in memory url so we are not limited by
the differences of various file systems. In order to get around the problem
on having really large filename with in memory db, I have been able to test
the 1024 bytes length limit for RDBNAM using following url with nested
directories. I will commit that change soon for DERBY-4805.
connect
'jdbc:derby://localhost/memory:dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/dir1234567890/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;create=true';
thanks again,
Mamta

On Mon, Feb 3, 2014 at 6:53 AM, Rick Hillegas <rick.hillegas@oracle.com>wrote:

> Hi Mamta,
>
> Some comments inline...
>
>
> On 1/31/14 3:18 PM, Mamta Satoor wrote:
>
>> 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:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;create=true';
>>
> For the record, that connection url works fine on Mac OSX. Maybe that long
> database name is not a legal file name on your file system?
>
> 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)
>>
> In-memory database names are canonicalized just like on-disk database
> names. That is, the part after the "memory:" token is treated as a file
> name. Relative and absolute file names are equivalent provided that they
> identify the same file name. So, on my file system the following two
> database names are equivalent:
>
> memory:foo
> memory:/Users/rh161140/derby/mainline/foo
>
> Enforcing this equivalence requires Derby to make java.io calls, even
> though nothing on disk is actually touched.
>
> Hope this helps,
> -Rick
>
>> 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 <mailto:%7B@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:
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
>> with class loader sun.misc.Launcher$AppClassLoader@53745374 <mailto:
>> sun.misc.Launcher$AppClassLoader@53745374>, see the next exception for
>> details.
>> java.sql.SQLException: Failed to start database 'memory:
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
>> with class loader sun.misc.Launcher$AppClassLoader@53745374 <mailto:
>> 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:
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
>> with class loader sun.misc.Launcher$AppClassLoader@53745374 <mailto:
>> 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