On 15.07.10 11:37, Sergey Ponomarev wrote:
Hi, help please.
I'm trying to use in-memory derby, but get "database 'login' not
found" error (java.sql.SQLException: Error in allocating a connection.
Cause: Connection could not be allocated because: База данных 'login'
не найдена.)
I've included derby,jar to classpath, specified connection URL
"jdbc:derby:memory:login;create=true", can't understand what am i
doing wrong.
create=true, so i suggest it should create and find it, but it
doesn't. Did not find anything useful in google.
Hi Sergey,
I'm not sure, but I think your data source definition is invalid.
Probably DatabaseName takes precedence over URL (I'm not even sure Derby
will use the URL property?).
If you remove URL, you should be able to add the following:
<property name="Create" value="create" />
<property name="DatabaseName" value="memory:login" />
Alternatively, if the create property doesn't work, you can maybe use
this instead:
<property name="ConnectionAttributes" value="create=true" />
Hope this helps,
--
Kristian
Here is the configuration:
domain.xml
=======================
<jdbc-connection-pool
datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource"
res-type="javax.sql.DataSource" name="TestPool">
<property name="URL" value="jdbc:derby:memory:login;create=true" />
<property name="driverClass"
value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="DatabaseName" value="login" />
<property name="User" value="" />
<property name="Password" value="" />
</jdbc-connection-pool>
<jdbc-resource pool-name="TestPool" jndi-name="jdbc/loginService" />
=========================
persistence.xml
=================================
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="LoginServicePU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/loginService</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
===================================
I'm a newbie, please don't blame me, any help is very appreciated.
Thank you.