db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: Derby as an in-memory JEE datasource
Date Fri, 08 Jan 2010 08:44:12 GMT
Marcin Kwapisz wrote:
> I think that sub-protocol "memory" is ignored. When I start Derby as a normal db server,
connection can be established (with that connection pool) and everything works fine. Maybe
I do something wrong. I do not know, so I asked if it is possible to configure in-memory database
as a datasource.
> This is my connection pool configuration:
> <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false"
connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit"
datasource-classname="org.apache.derby.jdbc.ClientDataSource" fail-all-connections="false"
idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true"
lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false"
max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="TestDBPoolMem"
non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource"
statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0"
>         <property name="serverName" value="localhost"/>
>         <property name="PortNumber" value="1527"/>
>         <property name="networkProtocol" value="jdbc:derby:memory"/>
>         <property name="DatabaseName" value="EntityTestDB"/>
>         <property name="User" value="testdb"/>
>         <property name="Password" value="testdb"/>
>     </jdbc-connection-pool>

Hi Marcin,

The network driver doesn't really support the memory subsubprotocol in a 
proper way, but you can try to either remove "networkProtocol" or set it 
to "jdbc:derby" if it is required  (not sure if it should end with a 
colon or not), and then specify "memory:EntityTestDB" as "DatabaseName".

There is some other information at 
http://wiki.apache.org/db-derby/InMemoryBackEndPrimer , but note that 
the proper way to drop an in-memory database in the next 
feauture-release will be to use the JDBC connection attribute ";drop=true".

> The error I got:
> INFO: EclipseLink, version: Eclipse Persistence Services - 2.0.0.v20091127-r5931
> 2010-01-08 09:16:45 com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator createResource
> WARNING: poolmgr.create_resource_error
> 2010-01-08 09:16:45 com.sun.enterprise.connectors.ConnectionManagerImpl internalGetConnection
> WARNING: poolmgr.get_connection_failure
> 2010-01-08 09:16:45 com.sun.gjc.spi.base.DataSource getConnection
> WARNING: jdbc.exc_get_conn
> 2010-01-08 09:16:45 org.eclipse.persistence.session.file: _InitPU.ejb
> Local Exception Stack: 
> Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931):
> Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection
could not be allocated because: java.net.ConnectException: Błąd podczas łączenia z serwerem
localhost na porcie 1527 z komunikatem Connection refused: connect.

I'm not quite sure why you get this error, maybe it's because of the 
specified network protocol. Otherwise, make sure your Derby network 
server is up and running.

Hope this helps,

> Regards
> Marcin Kwapisz

View raw message