-
1. Re: Embedded Connections & Transactions
shawkins Oct 11, 2012 8:33 PM (in response to sroberts)Teiid is not looking to duplicate connection pool / container behavior in either the server (where we rely on JBossAS) or embedded form. In embedded you are providing the connection factory and will therefore have to provide something that implements the desired transactional behavior. In this case you're looking for something similar to the JBoss connection pool "track connections by transaction" option. There are several open source connection pool projects that may fit your needs if you are not running in an app server environment that can provide similar functionality.
Steve
-
2. Re: Embedded Connections & Transactions
sroberts Oct 12, 2012 11:03 AM (in response to shawkins)Steve, thank you for your reply.
The use of connections was surprising. I was not expecting connections to open and close with every operation.
In my case, I have an existing database API that I want to incorporate into an existing JBoss server. I would also like to provide a JDBC interface for my APIs using Embedded Teiid. It looks like I will need two connectors, one for my JBoss server and another for the embedded server. My connector for the JBoss server will implement the standard Teiid connector and let the server handle connection pooling with the “track connections by transaction” option.
I have to write connection tracking and transactions myself for the embedded case. I benefit from a single user, with a single connection that has a single transaction context. I can change my connection factory to use a singleton, or to recycle connections. Since my JDBC connection is the only process creating connections, a commit/rollback on my JDBC connection is a commit or rollback on my connection factory.
The solution doesn’t seem like a proper use of Teiid. Is there a better way to solve this problem? Is there a way to implement the connection tracking and transaction behavior through the embedded server instead of the Teiid connector? Ideally, I would use the same connector for both JBoss and embedded servers.
-
3. Re: Embedded Connections & Transactions
shawkins Oct 12, 2012 11:45 AM (in response to sroberts)>The use of connections was surprising. I was not expecting connections to open and close with every operation.
That is a standard way of interacting with pooled connections. You rely on the pool to keep the connections open, perform the transaction enlistment, track by transaction, etc.
> The solution doesn’t seem like a proper use of Teiid. Is there a better way to solve this problem? Is there a way to implement the connection tracking and transaction behavior through the embedded server instead of the Teiid connector? Ideally, I would use the same connector for both JBoss and embedded servers.
The translator/ExecutionFatory should be the same in both cases - that is really the Teiid conern. We aren't looking to elevate additional concerns into Teiid embedded. What envrionement are you looking to run embedded in? If you already have a refernece to a TransactionManager are the other facilities for creating XA connection pools?