You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by do...@xsinet.co.za on 2014/03/11 14:48:47 UTC

Setting the Transaction Isolation Level

Hi All

I'm using jTDS to connect to a MS SQL db, their default setting for
transaction isolation is READ_COMMITED which I would like to change.

jTDS doesn't seem to have a property that can be sent via the connection
URL so that means that I need to change it through Cayenne.

So can anyone show me how one changes the default transaction isolation
level ?

Thanks
Jurgen



Re: DBCPDataSourceFactory

Posted by Andrus Adamchik <an...@objectstyle.org>.

On Mar 13, 2014, at 5:19 PM, Michael Gentry <mg...@masslight.net> wrote:

> On Thu, Mar 13, 2014 at 2:49 AM, <do...@xsinet.co.za> wrote:
> 
>> I agree Andrus, however I'm not comfortable with having a username &
>> password in a properties file unless encrypted.
>> Now the XMLPoolingDataSourceFactory in the Modeler caters for a password
>> encoder, which is great.
>> 
> 
> Cayenne Modeler already supports encrypted passwords under the Password
> Encoder tab for a DataNode if that is helpful.

And by the way this is something I’d like to externalize. Modeler just seems like a wrong place for managing complex cross-environment strategies.

A.


Re: DBCPDataSourceFactory

Posted by do...@xsinet.co.za.
I've had a look at the DBCPDataSourceFactory source which is part of Cayenne 
and think that a Password Encoder can easily be accommodated.
Don't know about JNDI.

Regards
Jurgen


-----Original Message----- 
From: Michael Gentry
Sent: Thursday, March 13, 2014 5:33 PM
To: Cayenne Users
Subject: Re: DBCPDataSourceFactory

Ah yes, that's right.  Same for JNDI, too.  This is because the DB
connection is being provided by a framework outside of Cayenne.

mrg



On Thu, Mar 13, 2014 at 10:53 AM, <do...@xsinet.co.za> wrote:

> Yes thanks Michael,
>
> but unfortunately the Password Encoder tab becomes disabled when you
> select DBCPDataSourceFactory.
>
> Created a RFE in Jira for this:  CAY-1910
>
> Regards
> Jurgen
>
>
> -----Original Message----- From: Michael Gentry
> Sent: Thursday, March 13, 2014 4:19 PM
> To: Cayenne Users
> Subject: Re: DBCPDataSourceFactory
>
>
> On Thu, Mar 13, 2014 at 2:49 AM, <do...@xsinet.co.za> wrote:
>
>  I agree Andrus, however I'm not comfortable with having a username &
>> password in a properties file unless encrypted.
>> Now the XMLPoolingDataSourceFactory in the Modeler caters for a password
>> encoder, which is great.
>>
>>
> Cayenne Modeler already supports encrypted passwords under the Password
> Encoder tab for a DataNode if that is helpful.
> 


Re: DBCPDataSourceFactory

Posted by Michael Gentry <mg...@masslight.net>.
Ah yes, that's right.  Same for JNDI, too.  This is because the DB
connection is being provided by a framework outside of Cayenne.

mrg



On Thu, Mar 13, 2014 at 10:53 AM, <do...@xsinet.co.za> wrote:

> Yes thanks Michael,
>
> but unfortunately the Password Encoder tab becomes disabled when you
> select DBCPDataSourceFactory.
>
> Created a RFE in Jira for this:  CAY-1910
>
> Regards
> Jurgen
>
>
> -----Original Message----- From: Michael Gentry
> Sent: Thursday, March 13, 2014 4:19 PM
> To: Cayenne Users
> Subject: Re: DBCPDataSourceFactory
>
>
> On Thu, Mar 13, 2014 at 2:49 AM, <do...@xsinet.co.za> wrote:
>
>  I agree Andrus, however I'm not comfortable with having a username &
>> password in a properties file unless encrypted.
>> Now the XMLPoolingDataSourceFactory in the Modeler caters for a password
>> encoder, which is great.
>>
>>
> Cayenne Modeler already supports encrypted passwords under the Password
> Encoder tab for a DataNode if that is helpful.
>

Re: DBCPDataSourceFactory

Posted by do...@xsinet.co.za.
Yes thanks Michael,

but unfortunately the Password Encoder tab becomes disabled when you select 
DBCPDataSourceFactory.

Created a RFE in Jira for this:  CAY-1910

Regards
Jurgen


-----Original Message----- 
From: Michael Gentry
Sent: Thursday, March 13, 2014 4:19 PM
To: Cayenne Users
Subject: Re: DBCPDataSourceFactory

On Thu, Mar 13, 2014 at 2:49 AM, <do...@xsinet.co.za> wrote:

> I agree Andrus, however I'm not comfortable with having a username &
> password in a properties file unless encrypted.
> Now the XMLPoolingDataSourceFactory in the Modeler caters for a password
> encoder, which is great.
>

Cayenne Modeler already supports encrypted passwords under the Password
Encoder tab for a DataNode if that is helpful. 


Re: DBCPDataSourceFactory

Posted by Michael Gentry <mg...@masslight.net>.
On Thu, Mar 13, 2014 at 2:49 AM, <do...@xsinet.co.za> wrote:

> I agree Andrus, however I'm not comfortable with having a username &
> password in a properties file unless encrypted.
> Now the XMLPoolingDataSourceFactory in the Modeler caters for a password
> encoder, which is great.
>

Cayenne Modeler already supports encrypted passwords under the Password
Encoder tab for a DataNode if that is helpful.

Re: DBCPDataSourceFactory

Posted by do...@xsinet.co.za.
Ok, have created Jira ...
https://issues.apache.org/jira/browse/CAY-1909

Thanks Andrus

-----Original Message----- 
From: Andrus Adamchik
Sent: Thursday, March 13, 2014 9:17 AM
To: user@cayenne.apache.org
Subject: Re: DBCPDataSourceFactory


On Mar 13, 2014, at 9:49 AM, dollj@xsinet.co.za wrote:

> RFE:  If there was a 
> org.apache.cayenne.configuration.Constants.TRANSACTION_ISOLATION property 
> then you could just put that into the Constants.PROPERTIES_MAP for the 
> XMLPoolingDataSourceFactory to use.

Good idea. Perhaps Jira that? We can combine that with other “jdbc” 
properties.

Andrus


Re: DBCPDataSourceFactory

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Mar 13, 2014, at 9:49 AM, dollj@xsinet.co.za wrote:

> RFE:  If there was a org.apache.cayenne.configuration.Constants.TRANSACTION_ISOLATION property then you could just put that into the Constants.PROPERTIES_MAP for the XMLPoolingDataSourceFactory to use.

Good idea. Perhaps Jira that? We can combine that with other “jdbc” properties.

Andrus


Re: DBCPDataSourceFactory

Posted by do...@xsinet.co.za.
I agree Andrus, however I'm not comfortable with having a username & 
password in a properties file unless encrypted.
Now the XMLPoolingDataSourceFactory in the Modeler caters for a password 
encoder, which is great.

However the database I'm using has a default transaction isolation level of 
READ_COMMITED which I would like to change.
I can't seem to do this with the XMLPoolingDataSourceFactory, but the 
DBCPDataSourceFactory can.
The problem though is that the username and password are in plain text with 
this factory.

So I'm going to have to "hack" one of them ....

RFE:  If there was a 
org.apache.cayenne.configuration.Constants.TRANSACTION_ISOLATION property 
then you could just put that into the Constants.PROPERTIES_MAP for the 
XMLPoolingDataSourceFactory to use.

Thanks, regards
Jurgen


-----Original Message----- 
From: Andrus Adamchik
Sent: Thursday, March 13, 2014 8:09 AM
To: user@cayenne.apache.org
Subject: Re: DBCPDataSourceFactory


On Mar 12, 2014, at 8:50 PM, dollj@xsinet.co.za wrote:

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

Usually the problem with specifying password (and other settings) in the 
Modeler is that they are different between your dev environment and final 
deployment environment. So while properties are not as simple as using UI, 
it is a sensible alternative that will let you change those without 
unpacking your deployment artifacts, etc.

Andrus


Re: DBCPDataSourceFactory

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Mar 12, 2014, at 8:50 PM, dollj@xsinet.co.za wrote:

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

Usually the problem with specifying password (and other settings) in the Modeler is that they are different between your dev environment and final deployment environment. So while properties are not as simple as using UI, it is a sensible alternative that will let you change those without unpacking your deployment artifacts, etc.

Andrus


Re: DBCPDataSourceFactory

Posted by do...@xsinet.co.za.
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,  <do...@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,  <do...@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,  <do...@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
>>>
>>
> 


Re: DBCPDataSourceFactory

Posted by Mike Kienenberger <mk...@gmail.com>.
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,  <do...@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,  <do...@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,  <do...@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
>>>
>>
>

Re: DBCPDataSourceFactory

Posted by do...@xsinet.co.za.
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,  <do...@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,  <do...@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
>>
> 


Re: DBCPDataSourceFactory

Posted by Mike Kienenberger <mk...@gmail.com>.
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,  <do...@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,  <do...@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
>>
>

Re: DBCPDataSourceFactory

Posted by do...@xsinet.co.za.
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,  <do...@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
> 


Re: DBCPDataSourceFactory

Posted by Mike Kienenberger <mk...@gmail.com>.
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,  <do...@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
>

DBCPDataSourceFactory

Posted by do...@xsinet.co.za.
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


Re: Setting the Transaction Isolation Level

Posted by do...@xsinet.co.za.
Hi Mike

Thanks for your input, I had a look and found that I can specify a 
DBCPDataSourceFactory in the modeler.
Found some info on that here 
http://cayenne.apache.org/docs/3.0/dbcpdatasourcefactory.html

In short DBCPDataSourceFactory uses a properties file specified in the 
modeler that can contain various DataSource properties, connection pool 
properties and prepared statement pool properties.
I'll give it a try and see what happens.

Thanks again, regards
Jurgen


-----Original Message----- 
From: Mike Kienenberger
Sent: Tuesday, March 11, 2014 8:06 PM
To: user@cayenne.apache.org
Subject: Re: Setting the Transaction Isolation Level

For what it's worth, I configure my pool manager in Cayenne 3.1 via a
factory in the cayenne.xml file:

    <node name="SomeNode"
         factory="com.xyz.cayenne.ConfigFilePoolingDataSourceFactory"


On Tue, Mar 11, 2014 at 2:00 PM,  <do...@xsinet.co.za> wrote:
> Thanks Laurent
>
> I understand the MyPoolManager class but I'm not sure about how to use it 
> as
> you demonstrated.
> I am using 3.1 though and have a static method:
>
> public static DataContext getContext()
> {
>        if ( server == null )
>        {
>                String  iniFile = .....;
>               MyDataSourceModule  module = new MyDataSourceModule( iniFile
> );
>                server = new ServerRuntime( "cayenne-Vision.xml", module );
>        }
>        return (DataContext) server.getContext();
> }
>
> So how do I further configure ServerRuntime to accommodate MyPoolManager ?
>
> Thanks,
> Jurgen
>
>
> -----Original Message----- From: Laurent Marchal
> Sent: Tuesday, March 11, 2014 4:27 PM
> To: user@cayenne.apache.org
> Subject: Re: Setting the Transaction Isolation Level
>
>
> Hi Jurgen,
>
>     In Cayenne 3.0 I achieved this by extending PoolManager with my own
> class and override the newPooledConnection() method. I don't know about
> Cayenne 3.1
>
> Class MyPoolManager :
>     @Override
>     protected PooledConnection newPooledConnection(String userName,
> String password) throws SQLException {
>         // override superclass to call stored procedure
>         final PooledConnection pConn =
> super.newPooledConnection(userName, password);
>         Connection connection = pConn.getConnection();
>         connection.setAutoCommit(false); // disable auto commit
> connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
> // avoid deadlock on big SELECTs
>
>         return pConn;
>     }
>
> To use MyPoolManager do :
>
>         DataDomain domain = _conf.getDomain();
>         DataNode node = domain.getNode(CAYENNE_DATANODE);
>         try {
>             ConnectionPoolDataSource dataSource =
> getDataSourceFromConfig(config);
>             OpconPoolManager poolManager = new
> MyPoolManager(_listenerList, dataSource, config.getDatabaseUser(),
> config.getDatabasePassword(), user);
>             node.setDataSource(poolManager);
>             return poolManager;
>
>         } catch (SQLException e) {
>             throw new MyException("Cannot create database connection
> pool, bad database configuration: " + config.getDataSourceUrl(), e);
>         }
>
> Hope this helps,
> Laurent.
>
> On 3/11/14, 8:48 AM, dollj@xsinet.co.za wrote:
>>
>> Hi All
>>
>> I'm using jTDS to connect to a MS SQL db, their default setting for
>> transaction isolation is READ_COMMITED which I would like to change.
>>
>> jTDS doesn't seem to have a property that can be sent via the connection
>> URL so that means that I need to change it through Cayenne.
>>
>> So can anyone show me how one changes the default transaction isolation
>> level ?
>>
>> Thanks
>> Jurgen
>>
>>
> 


Re: Setting the Transaction Isolation Level

Posted by Mike Kienenberger <mk...@gmail.com>.
For what it's worth, I configure my pool manager in Cayenne 3.1 via a
factory in the cayenne.xml file:

    <node name="SomeNode"
         factory="com.xyz.cayenne.ConfigFilePoolingDataSourceFactory"


On Tue, Mar 11, 2014 at 2:00 PM,  <do...@xsinet.co.za> wrote:
> Thanks Laurent
>
> I understand the MyPoolManager class but I'm not sure about how to use it as
> you demonstrated.
> I am using 3.1 though and have a static method:
>
> public static DataContext getContext()
> {
>        if ( server == null )
>        {
>                String  iniFile = .....;
>               MyDataSourceModule  module = new MyDataSourceModule( iniFile
> );
>                server = new ServerRuntime( "cayenne-Vision.xml", module );
>        }
>        return (DataContext) server.getContext();
> }
>
> So how do I further configure ServerRuntime to accommodate MyPoolManager ?
>
> Thanks,
> Jurgen
>
>
> -----Original Message----- From: Laurent Marchal
> Sent: Tuesday, March 11, 2014 4:27 PM
> To: user@cayenne.apache.org
> Subject: Re: Setting the Transaction Isolation Level
>
>
> Hi Jurgen,
>
>     In Cayenne 3.0 I achieved this by extending PoolManager with my own
> class and override the newPooledConnection() method. I don't know about
> Cayenne 3.1
>
> Class MyPoolManager :
>     @Override
>     protected PooledConnection newPooledConnection(String userName,
> String password) throws SQLException {
>         // override superclass to call stored procedure
>         final PooledConnection pConn =
> super.newPooledConnection(userName, password);
>         Connection connection = pConn.getConnection();
>         connection.setAutoCommit(false); // disable auto commit
> connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
> // avoid deadlock on big SELECTs
>
>         return pConn;
>     }
>
> To use MyPoolManager do :
>
>         DataDomain domain = _conf.getDomain();
>         DataNode node = domain.getNode(CAYENNE_DATANODE);
>         try {
>             ConnectionPoolDataSource dataSource =
> getDataSourceFromConfig(config);
>             OpconPoolManager poolManager = new
> MyPoolManager(_listenerList, dataSource, config.getDatabaseUser(),
> config.getDatabasePassword(), user);
>             node.setDataSource(poolManager);
>             return poolManager;
>
>         } catch (SQLException e) {
>             throw new MyException("Cannot create database connection
> pool, bad database configuration: " + config.getDataSourceUrl(), e);
>         }
>
> Hope this helps,
> Laurent.
>
> On 3/11/14, 8:48 AM, dollj@xsinet.co.za wrote:
>>
>> Hi All
>>
>> I'm using jTDS to connect to a MS SQL db, their default setting for
>> transaction isolation is READ_COMMITED which I would like to change.
>>
>> jTDS doesn't seem to have a property that can be sent via the connection
>> URL so that means that I need to change it through Cayenne.
>>
>> So can anyone show me how one changes the default transaction isolation
>> level ?
>>
>> Thanks
>> Jurgen
>>
>>
>

Re: Setting the Transaction Isolation Level

Posted by do...@xsinet.co.za.
Thanks Laurent

I understand the MyPoolManager class but I'm not sure about how to use it as 
you demonstrated.
I am using 3.1 though and have a static method:

public static DataContext getContext()
{
        if ( server == null )
        {
                String  iniFile = .....;
               MyDataSourceModule  module = new MyDataSourceModule( 
iniFile );
                server = new ServerRuntime( "cayenne-Vision.xml", module );
        }
        return (DataContext) server.getContext();
}

So how do I further configure ServerRuntime to accommodate MyPoolManager ?

Thanks,
Jurgen


-----Original Message----- 
From: Laurent Marchal
Sent: Tuesday, March 11, 2014 4:27 PM
To: user@cayenne.apache.org
Subject: Re: Setting the Transaction Isolation Level

Hi Jurgen,

     In Cayenne 3.0 I achieved this by extending PoolManager with my own
class and override the newPooledConnection() method. I don't know about
Cayenne 3.1

Class MyPoolManager :
     @Override
     protected PooledConnection newPooledConnection(String userName,
String password) throws SQLException {
         // override superclass to call stored procedure
         final PooledConnection pConn =
super.newPooledConnection(userName, password);
         Connection connection = pConn.getConnection();
         connection.setAutoCommit(false); // disable auto commit
connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
// avoid deadlock on big SELECTs

         return pConn;
     }

To use MyPoolManager do :

         DataDomain domain = _conf.getDomain();
         DataNode node = domain.getNode(CAYENNE_DATANODE);
         try {
             ConnectionPoolDataSource dataSource =
getDataSourceFromConfig(config);
             OpconPoolManager poolManager = new
MyPoolManager(_listenerList, dataSource, config.getDatabaseUser(),
config.getDatabasePassword(), user);
             node.setDataSource(poolManager);
             return poolManager;

         } catch (SQLException e) {
             throw new MyException("Cannot create database connection
pool, bad database configuration: " + config.getDataSourceUrl(), e);
         }

Hope this helps,
Laurent.

On 3/11/14, 8:48 AM, dollj@xsinet.co.za wrote:
> Hi All
>
> I'm using jTDS to connect to a MS SQL db, their default setting for
> transaction isolation is READ_COMMITED which I would like to change.
>
> jTDS doesn't seem to have a property that can be sent via the connection
> URL so that means that I need to change it through Cayenne.
>
> So can anyone show me how one changes the default transaction isolation
> level ?
>
> Thanks
> Jurgen
>
>


Re: Setting the Transaction Isolation Level

Posted by Laurent Marchal <lm...@smasolutions.it>.
Hi Jurgen,

     In Cayenne 3.0 I achieved this by extending PoolManager with my own 
class and override the newPooledConnection() method. I don't know about 
Cayenne 3.1

Class MyPoolManager :
     @Override
     protected PooledConnection newPooledConnection(String userName, 
String password) throws SQLException {
         // override superclass to call stored procedure
         final PooledConnection pConn = 
super.newPooledConnection(userName, password);
         Connection connection = pConn.getConnection();
         connection.setAutoCommit(false); // disable auto commit
connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); 
// avoid deadlock on big SELECTs

         return pConn;
     }

To use MyPoolManager do :

         DataDomain domain = _conf.getDomain();
         DataNode node = domain.getNode(CAYENNE_DATANODE);
         try {
             ConnectionPoolDataSource dataSource = 
getDataSourceFromConfig(config);
             OpconPoolManager poolManager = new 
MyPoolManager(_listenerList, dataSource, config.getDatabaseUser(), 
config.getDatabasePassword(), user);
             node.setDataSource(poolManager);
             return poolManager;

         } catch (SQLException e) {
             throw new MyException("Cannot create database connection 
pool, bad database configuration: " + config.getDataSourceUrl(), e);
         }

Hope this helps,
Laurent.

On 3/11/14, 8:48 AM, dollj@xsinet.co.za wrote:
> Hi All
>
> I'm using jTDS to connect to a MS SQL db, their default setting for
> transaction isolation is READ_COMMITED which I would like to change.
>
> jTDS doesn't seem to have a property that can be sent via the connection
> URL so that means that I need to change it through Cayenne.
>
> So can anyone show me how one changes the default transaction isolation
> level ?
>
> Thanks
> Jurgen
>
>