You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by jp4 <jo...@hnpsolutions.com> on 2008/06/17 20:03:20 UTC

Does Embedded Driver Support Multiple Databases

I am trying to mimic an standalone version of a test and production
environment using Derby.  When I run my unit test cases, I would like to
load two databases using the EmbeddedDriver.  Does the EmbeddedDriver
support mulitple databases?  If so, how is this accomplished.  

I am trying to startup the datasources using the Spring configuration Below

        <bean id="dataSourcePerm"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
                p:driverClassName="${jdbc.driverClassName}" 
                p:url="${jdbc.url.perm}" 
                p:username="${jdbc.username}"
                p:password="${jdbc.password}" />
        
	<bean id="dataSourceTemp"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
                p:driverClassName="${jdbc.driverClassName}" 
                p:url="${jdbc.url.temp}" 
                p:username="${jdbc.username}"
                p:password="${jdbc.password}" />

With properties

jdbc.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
jdbc.url.perm=jdbc:derby:../benefitrealization-dataaccess/target/brpermdb
jdbc.url.temp=jdbc:derby:../benefitrealization-dataaccess/target/brtempdb
jdbc.username=user
jdbc.password=password

When I try running my unit tests with this configuration, I get the
following error:

is java.sql.SQLException: Failed to start database
'../benefitrealization-dataaccess/target/brpermdb', 

Thanks,

jp4
-- 
View this message in context: http://www.nabble.com/Does-Embedded-Driver-Support-Multiple-Databases-tp17929196p17929196.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Does Embedded Driver Support Multiple Databases

Posted by jp4 <jo...@hnpsolutions.com>.
Rick,

Thanks for the info.  I did a bit more digging and found that the error was
due to the fact that I didn't shutdown the database (using the
maven-sql-plugin) before executing my unit test cases.  Once I did that,
both datasources worked fine.

Thanks,

John 


Rick Hillegas-2 wrote:
> 
> Hi John,
> 
> You should be able to wrap a separate data source around each of your 
> databases and access them both via the same EmbeddedDriver. There is not 
> much information in this SQLException. Can you share more of the stack 
> trace and/or the derby log file? That will help us puzzle through this.
> 
> Thanks,
> -Rick
> 
> jp4 wrote:
>> I am trying to mimic an standalone version of a test and production
>> environment using Derby.  When I run my unit test cases, I would like to
>> load two databases using the EmbeddedDriver.  Does the EmbeddedDriver
>> support mulitple databases?  If so, how is this accomplished.  
>>
>> I am trying to startup the datasources using the Spring configuration
>> Below
>>
>>         <bean id="dataSourcePerm"
>> class="org.springframework.jdbc.datasource.DriverManagerDataSource"
>>                 p:driverClassName="${jdbc.driverClassName}" 
>>                 p:url="${jdbc.url.perm}" 
>>                 p:username="${jdbc.username}"
>>                 p:password="${jdbc.password}" />
>>         
>> 	<bean id="dataSourceTemp"
>> class="org.springframework.jdbc.datasource.DriverManagerDataSource"
>>                 p:driverClassName="${jdbc.driverClassName}" 
>>                 p:url="${jdbc.url.temp}" 
>>                 p:username="${jdbc.username}"
>>                 p:password="${jdbc.password}" />
>>
>> With properties
>>
>> jdbc.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
>> jdbc.url.perm=jdbc:derby:../benefitrealization-dataaccess/target/brpermdb
>> jdbc.url.temp=jdbc:derby:../benefitrealization-dataaccess/target/brtempdb
>> jdbc.username=user
>> jdbc.password=password
>>
>> When I try running my unit tests with this configuration, I get the
>> following error:
>>
>> is java.sql.SQLException: Failed to start database
>> '../benefitrealization-dataaccess/target/brpermdb', 
>>
>> Thanks,
>>
>> jp4
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Does-Embedded-Driver-Support-Multiple-Databases-tp17929196p17936500.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Does Embedded Driver Support Multiple Databases

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi John,

You should be able to wrap a separate data source around each of your 
databases and access them both via the same EmbeddedDriver. There is not 
much information in this SQLException. Can you share more of the stack 
trace and/or the derby log file? That will help us puzzle through this.

Thanks,
-Rick

jp4 wrote:
> I am trying to mimic an standalone version of a test and production
> environment using Derby.  When I run my unit test cases, I would like to
> load two databases using the EmbeddedDriver.  Does the EmbeddedDriver
> support mulitple databases?  If so, how is this accomplished.  
>
> I am trying to startup the datasources using the Spring configuration Below
>
>         <bean id="dataSourcePerm"
> class="org.springframework.jdbc.datasource.DriverManagerDataSource"
>                 p:driverClassName="${jdbc.driverClassName}" 
>                 p:url="${jdbc.url.perm}" 
>                 p:username="${jdbc.username}"
>                 p:password="${jdbc.password}" />
>         
> 	<bean id="dataSourceTemp"
> class="org.springframework.jdbc.datasource.DriverManagerDataSource"
>                 p:driverClassName="${jdbc.driverClassName}" 
>                 p:url="${jdbc.url.temp}" 
>                 p:username="${jdbc.username}"
>                 p:password="${jdbc.password}" />
>
> With properties
>
> jdbc.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
> jdbc.url.perm=jdbc:derby:../benefitrealization-dataaccess/target/brpermdb
> jdbc.url.temp=jdbc:derby:../benefitrealization-dataaccess/target/brtempdb
> jdbc.username=user
> jdbc.password=password
>
> When I try running my unit tests with this configuration, I get the
> following error:
>
> is java.sql.SQLException: Failed to start database
> '../benefitrealization-dataaccess/target/brpermdb', 
>
> Thanks,
>
> jp4
>