You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "David Blevins (JIRA)" <ji...@apache.org> on 2007/08/13 21:59:30 UTC

[jira] Closed: (OPENEJB-3) Transactional Support in connector/jdbc bridge

     [ https://issues.apache.org/jira/browse/OPENEJB-3?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Blevins closed OPENEJB-3.
-------------------------------

    Resolution: Invalid

We're using an enhanced version of commons-dbcp that now supports transactions and are deprecating our own jdbc connector code.

> Transactional Support in connector/jdbc bridge
> ----------------------------------------------
>
>                 Key: OPENEJB-3
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-3
>             Project: OpenEJB
>          Issue Type: Improvement
>          Components: connectors
>            Reporter: hamilton verissimo
>         Attachments: ConnectorJdbc.patch, JdbcTransactionalManagedConnection.java, JdbcTransactionalManagedConnectionFactory.java
>
>
> Tested with geronimo implementation and Oracle database. Follows my test code:
> public class Main implements ManagedConnectionFactoryListener
> {
>   public Main() throws Exception
>   {
> 	TransactionManagerImpl transactionManager = new TransactionManagerImpl(); 
> 	ContainerTransactionContext transactionContext = 
> 		new ContainerTransactionContext(transactionManager);
> 	TransactionContext.setContext(transactionContext);
> 		
> 	ConnectionTrackingCoordinator ctc = new ConnectionTrackingCoordinator();
> 		
> 	ConnectionManagerDeployment cmd = 
> 	new ConnectionManagerDeployment(true, false, true, true, true, 10, 1000 * 60, new MyRealmBridge(), ctc);
> 	cmd.doStart();
> 	ManagedConnectionFactoryWrapper mcf = new ManagedConnectionFactoryWrapper(
> 			JdbcTransactionalManagedConnectionFactory.class, 
> 		DataSource.class, 
> 		JdbcConnectionFactory.class, 
> 		JdbcConnection.class,
> 		null, 
> 		"Nome", 
> 		null,
> 		cmd,
> 		this);
> 			
>         mcf.doStart();
> 		
> 	transactionContext.begin();
>     	
> 	DataSource cf = (DataSource) mcf.getProxy();
> 	Connection conn = cf.getConnection();
> 	Statement stmt = conn.createStatement();
> 	stmt.execute("Delete from LOG_ATUALIZACAO");
> 	stmt.close();
> 	conn.close();
> 		
> 	mcf.doStop();
> 	transactionContext.commit();
> }
>     public void setManagedConnectionFactory(ManagedConnectionFactory managedConnectionFactory)
>     {
>     	if ( managedConnectionFactory == null )
>     	{
>     		return;
>     	}
> 	JdbcTransactionalManagedConnectionFactory conn = 
> 	(JdbcTransactionalManagedConnectionFactory) managedConnectionFactory;
> 		
> 	try
> 	{
> 		conn.setXADataSourceClass( "oracle.jdbc.xa.client.OracleXADataSource" );
> 		conn.setDefaultUserName("..");
> 		conn.setDefaultPassword("..");
> 		conn.setJdbcUrl("jdbc:oracle:thin:@...");
> 	}
> 	catch(Exception ex)
> 	{
> 		ex.printStackTrace();
> 	}
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.