@Override

      public DataSource getDataSource(String arg0) throws Exception {

            DatabaseSettings settings = new DatabaseSettings();

            settings.load();

            

            // Set up the driver, in case it's not on the classpath

            try {

                  DriverManager.getDriver(settings.url);

            } catch(SQLException e) {

                  Out.debug(getClass(), "Registering " +
settings.driver);

                  Driver d =
(Driver)JARLoader.forName(settings.driver).newInstance();

                  DriverManager.registerDriver(new DriverShim(d));

            }

            

            // Connect

            Out.debug(getClass(), "Connecting to " + settings.url);

            conn = DriverManager.getConnection(settings.url,
settings.username, settings.password);

            

            // Wrap the connection

            return new ConnectionSource(conn);

      }

 

      @Override

      public void initializeWithParentConfiguration(Configuration
parentConfiguration) {

 
super.initializeWithParentConfiguration(parentConfiguration);

      }

 

-----Original Message-----
From: Andrus Adamchik [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 03, 2008 12:43 PM
To: [email protected]
Subject: Re: How can I customize the driver/url/login

 

> I'm using a custom DataSourceFactory now;

 

 

So how does this code look like? There's something in the DataSource  

it returns that results in the errors you've mentioned.

 

Andrus

 

On Apr 3, 2008, at 7:18 PM, Scott Anderson wrote:

 

> I'm using a custom DataSourceFactory now; if I switch it back to

> DriverDataSourceFactory and set the minimum connections to 2, Derby

> complains about how there can't be two connections, as I'm using the

> EmbeddedDriver.

> 

> -----Original Message-----

> From: Michael Gentry [mailto:[EMAIL PROTECTED]

> Sent: Thursday, April 03, 2008 12:01 PM

> To: [email protected]

> Subject: Re: How can I customize the driver/url/login

> 

> Just for kicks, bump up your minimum DB connections in the modeler and

> see what happens ...

> 

> 

> On Thu, Apr 3, 2008 at 11:37 AM, Scott Anderson  

> <[EMAIL PROTECTED]>

> wrote:

>> While I know enough to briefly describe what a connection pool is, I

>> have no idea how Cayenne uses it, or how it's configured. Could you

> go

>> in to a little more detail? AFAIK, I'm using what ever the default

>> settings are.

>> 

>> It seems unlikely to me that it's derby related because when I use

> the

>> modeler to specify the database location, I don't see anything like

>> this. Could it be that the adapter isn't being specified? I noticed

> that

>> Cayenne is warning that it's using the "automatic" one.

>> 

>> Apr 3, 2008 11:33:56 AM org.apache.cayenne.conf.RuntimeLoadDelegate

>> initAdapter

>> INFO: no adapter set, using automatic adapter.

> 

 

Reply via email to