cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <do...@xsinet.co.za>
Subject Re: DBCPDataSourceFactory
Date Wed, 12 Mar 2014 17:50:52 GMT
Yip, that's what I was using in the Modeler but the username and pass have 
to be in a properties file and I was hoping that there was a simple 
alternative.

Anyway I've downloaded the Cayenne source and will extend either 
DBCPDataSourceFactory  or  XMLPoolingDataSourceFactory.

Thanks again, regards
Jurgen


-----Original Message----- 
From: Mike Kienenberger
Sent: Wednesday, March 12, 2014 7:10 PM
To: user@cayenne.apache.org
Subject: Re: DBCPDataSourceFactory

There should already be a

org.apache.cayenne.configuration.server.DBCPDataSourceFactory

http://cayenne.apache.org/docs/3.0/dbcpdatasourcefactory.html

that will either do what you want, or serve as an example for how to
create your own customized version of it.   I needed a file-based data
source factory, so I copied XMLPoolingDataSourceFactory and made it
work with my own file format.

On Wed, Mar 12, 2014 at 1:00 PM,  <dollj@xsinet.co.za> wrote:
> Thanks again Mike
>
>
>> I don't manually configure or bind the DataSourceFactory to the
>> serverRuntime, but instead allow it to pull it in from the cayenne.xml 
>> file.
>
> Ok, you mentioned this before and I see in the Modeler where this can be
> specified.
>
> I take it then that MyDataSourceFactory  just needs the one method you 
> show
> below, getDataSource().
> This where I then create the DBCP Data Source and just return it.
>
> I'll have a go at it and see.
>
>
> Thanks, regards
> Jurgen
>
>
>
> -----Original Message----- From: Mike Kienenberger
> Sent: Wednesday, March 12, 2014 6:41 PM
>
> To: user@cayenne.apache.org
> Subject: Re: DBCPDataSourceFactory
>
> I'm not an expert on this, but I'd set those values when I created the
> Data Source.   For my DataSourceFactory, this happens in
> getDataSource().  I don't manually configure or bind the
> DataSourceFactory to the serverRuntime, but instead allow it to pull
> it in from the cayenne.xml file.
>
>
>    public DataSource getDataSource(DataNodeDescriptor nodeDescriptor)
> throws Exception {
>
> [...]
>
>            return new PoolManager(
>                    jdbcDriver,
>                    dataSourceUrl,
>                    minConnections,
>                    maxConnections,
>                    userName,
>                    password,
>                    jdbcEventLogger);
>
>
> On Wed, Mar 12, 2014 at 12:08 PM,  <dollj@xsinet.co.za> wrote:
>>
>> Thanks Mike
>>
>> Do I setup the BasicDataSource in the module I pass to ServerRuntime ?
>>
>> I've got:
>>
>>            String  iniFile = .....;
>>            MyDataSourceModule  module = new MyDataSourceModule(iniFile);
>>             server = new ServerRuntime( "cayenne-Vision.xml", module );
>>
>> Do I then in MyDataSourceModule do something like:
>>
>> @Override
>> public void configure( Binder binder )
>>
>> {
>>      BasicDataSource ds = new BasicDataSource();
>>      ds.setUsername("scott");
>>      ds.setPassword("tiger");
>>
>>      // .... set other options etc.
>>
>>      binder.bind( BasicDataSource.class ).toInstance( ds );
>> }
>>
>> So the question is if I manually configure a DBCP Data Source how do I
>> pass
>> then pass on to Cayenne ?
>>
>> Thanks, regards
>> Jurgen
>>
>>
>>
>>
>> -----Original Message----- From: Mike Kienenberger
>> Sent: Wednesday, March 12, 2014 5:02 PM
>> To: user@cayenne.apache.org
>> Subject: Re: DBCPDataSourceFactory
>>
>>
>> According to this
>>
>>
>> http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/BasicDataSourceExample.java?view=markup
>>
>> BasicDataSource ds = new BasicDataSource();
>> ds.setUsername("scott");
>> ds.setPassword("tiger");
>>
>>
>>
>> On Wed, Mar 12, 2014 at 5:01 AM,  <dollj@xsinet.co.za> wrote:
>>>
>>>
>>> Hi All
>>>
>>> I've successfully configured and used DBCP as a Data Source Factory  :-)
>>>
>>> Does anybody know how to provide the username and password besides
>>> through
>>> the properties file ?
>>>
>>> Thanks,
>>> Jurgen
>>>
>>
> 


Mime
View raw message