Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jta transaction and database

 
Brajendra Mathema
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i am trying to use jta in container managed application ,

so is it that JTA closes the database connection itself and we don't need to close the database connection explicitly..

if so in my application i am using stateless session bean and persistence unit with transaction type JTA

however i am facing problem of connection not available ... all the connection in the pool gets occupied and database throws exception telling maximum connection size reached....

i am wondering what is the problem....

if any one can help...any help would be appreciable

this is important to me..

thankyou

brajen
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How have you configured declarative security on your EJB? And what changes have you made to the configuration to ensure the container takes care of the transaction?

If done properly, you won't run out of connections to the database.

-Cameron McKenzie
 
Brajendra Mathema
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have injected the persistence context in my session bean as:

@PersistenceContext(unitName = "Project-PU")
private EntityManager em;




my glassfish setting under resource is as follows


General Settings

Name: mssql/db_mssql
Datasource Classname: com.microsoft.sqlserver.jdbc.SQLServerXADataSource
Resource Type: javax.sqlXADataSource




Pool Settings
Initial and Minimum Pool Size: 10 Connections
Maximum Pool Size: 100 Connections
Pool Resize Quantity: 5 Connections
Idle Timeout: 300 Seconds
Max Wait Time: 60000 Milliseconds

Connection Validation
Connection Validation: not checked(i.e disabled)
Validation Method: auto-commit(selected value)
Table Name: not selected
On Any Failure: not checked
Allow Non Component Callers: not checked


Transaction
Non Transactional Connections: Enabled
Transaction Isolation:not selected
Isolation Level: not selected


in advance tab : default values are used

so what's the problem...

any idea....
what else are the required setting for CMT in glassfish or stateless ejb class

thanks..
-brajen
 
Brajendra Mathema
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, in the above case do i have to use transaction attributes in the stateless session bean...

please give me some idea..

thankyou

brajen
 
Rajesh Kottayil
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
brajen mathema wrote:hi,

i have injected the persistence context in my session bean as:

@PersistenceContext(unitName = "Project-PU")
private EntityManager em;




my glassfish setting under resource is as follows


General Settings

Name: mssql/db_mssql
Datasource Classname: com.microsoft.sqlserver.jdbc.SQLServerXADataSource
Resource Type: javax.sqlXADataSource




Pool Settings
Initial and Minimum Pool Size: 10 Connections
Maximum Pool Size: 100 Connections
Pool Resize Quantity: 5 Connections
Idle Timeout: 300 Seconds
Max Wait Time: 60000 Milliseconds

Connection Validation
Connection Validation: not checked(i.e disabled)
Validation Method: auto-commit(selected value)
Table Name: not selected
On Any Failure: not checked
Allow Non Component Callers: not checked


Transaction
Non Transactional Connections: Enabled
Transaction Isolation:not selected
Isolation Level: not selected


in advance tab : default values are used

so what's the problem...

any idea....
what else are the required setting for CMT in glassfish or stateless ejb class

thanks..
-brajen



Hello brajen mathema,

I had one suggestion on database driver configuration you selected,
can you try it with the
com.microsoft.sqlserver.jdbc.SQLServerDataSource driver.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic