cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Anderson" <sander...@airvana.com>
Subject RE: How can I customize the driver/url/login
Date Thu, 03 Apr 2008 17:07:03 GMT
      @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:andrus@objectstyle.org] 
Sent: Thursday, April 03, 2008 12:43 PM
To: user@cayenne.apache.org
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:blacknext@gmail.com]

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

> To: user@cayenne.apache.org

> 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  

> <sanderson@airvana.com>

> 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.

> 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message