Subject Re: [Firebird-Java] Re: unavailable database with type2 and java as a service
Author Carsten Schäfer
Roman Rokytskyy wrote:

>> Another issue:
>> When i set dataSource.setDatabase() in local-mode i need to set url
>> like this: localhost/3050:c:/db.gdb.
>> When i only use c:/db.gdb as url my db need to be on the same drive
>> as my application.
>> The driver does not seem to care about the drive.
>
> Most likely this is a bug. Can you post here either configuration or
> code that you use to set up the datasource? Specifying localhost/3050
> will always cause your application to connect via sockets (type2
> mode), not via RPC. Reason to introduce local mode was that having
> string "localhost:/path/to/db" and "c:/path/to/db" we cannot easily
> distinguish that in latter case local mode should be used, because "c"
> is drive letter, not a host name.
>
FBWrappingDataSource dataSource = new FBWrappingDataSource();
dataSource.setDatabase("localhost/3050:e:/dbtest.gdb");
dataSource.setType("LOCAL");
dataSource.setUserName(user);
dataSource.setPassword(passwort);
dataSource.setEncoding("WIN1252");
dataSource.setMinConnections(5);
dataSource.setMaxConnections(20);
dataSource.setPooling(true);
dataSource.setBlockingTimeout(2000);
dataSource.setLoginTimeout(2000);

This is working always.
with:
dataSource.setDatabase("e:/dbtest.gdb");
if my application working dir is d and not drive e i get the following
exception:
org.firebirdsql.jdbc.FBSQLException: Resource Exception. I/O error during
"CreateFile (open)" operation for file "D:\DBTEST.GDB"
Error while trying to open file
null
Reason: I/O error during "CreateFile (open)" operation for file
"D:\DBTEST.GDB"
Error while trying to open file
null
at
org.firebirdsql.pool.FBConnectionPoolDataSource.allocateConnection(FBConnect
ionPoolDataSource.java:171)
at
org.firebirdsql.pool.PooledConnectionQueue.addConnection(PooledConnectionQue
ue.java:403)
at
org.firebirdsql.pool.PooledConnectionQueue.start(PooledConnectionQueue.java:
156)
at
org.firebirdsql.pool.AbstractConnectionPool.getQueue(AbstractConnectionPool.
java:182)
at
org.firebirdsql.pool.FBConnectionPoolDataSource.getFreeSize(FBConnectionPool
DataSource.java:314)
at
org.firebirdsql.pool.FBWrappingDataSource.getConnectionCount(FBWrappingDataS
ource.java:353)
at
com.TTC_Informatik.PAULA.server.App_Server.getConnection(App_Server.java:937
5)
at
com.TTC_Informatik.PAULA.server.App_Server.getReadConnection(App_Server.java
:7543)
at
com.TTC_Informatik.PAULA.server.App_Server.getAllDBObjekte(App_Server.java:2
616)
at
com.TTC_Informatik.PAULA.server.App_Server$7.construct(App_Server.java:7816)
at com.TTC_Informatik.PAULA.Tools.SwingWorker$2.run(SwingWorker.java:109)
at java.lang.Thread.run(Unknown Source)
at org.firebirdsql.gds.GDSException: I/O error during "CreateFile (open)"
operation for file "D:\DBTEST.GDB"
Error while trying to open file
null
at org.firebirdsql.ngds.GDS_Impl.native_isc_attach_database(Native Method)
at org.firebirdsql.ngds.GDS_Impl.isc_attach_database(GDS_Impl.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.firebirdsql.gds.GDSSynchronizationPolicy$AbstractSynchronizationPolicy.i
nvoke(GDSSynchronizationPolicy.java:100)
at $Proxy0.isc_attach_database(Unknown Source)
at
org.firebirdsql.jca.FBManagedConnectionFactory.createDbHandle(FBManagedConne
ctionFactory.java:540)
at
org.firebirdsql.jca.FBManagedConnection.<init>(FBManagedConnection.java:88)
at
org.firebirdsql.jca.FBManagedConnectionFactory.createManagedConnection(FBMan
agedConnectionFactory.java:366)
at
org.firebirdsql.pool.FBConnectionPoolDataSource.allocateConnection(FBConnect
ionPoolDataSource.java:146)
at
org.firebirdsql.pool.PooledConnectionQueue.addConnection(PooledConnectionQue
ue.java:403)
at
org.firebirdsql.pool.PooledConnectionQueue.start(PooledConnectionQueue.java:
156)
at
org.firebirdsql.pool.AbstractConnectionPool.getQueue(AbstractConnectionPool.
java:182)
at
org.firebirdsql.pool.FBConnectionPoolDataSource.getFreeSize(FBConnectionPool
DataSource.java:314)
at
org.firebirdsql.pool.FBWrappingDataSource.getConnectionCount(FBWrappingDataS
ource.java:353)
at
com.TTC_Informatik.PAULA.server.App_Server.getConnection(App_Server.java:937
5)

driver tries to find the database on my working drive, not on the specified
drive.

mfg
Carsten