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, do...@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




Reply via email to