users@glassfish.java.net

Re: [issue] can not store transaction log into database

From: sankara rao bhogi <Sankara.Rao_at_Sun.COM>
Date: Thu, 10 Jul 2008 10:09:35 +0530

Wang,

Step1 is not required. Transaction log record in the txn_log_table is
quite short lived, hence it is pretty difficult to realize if there is
any data written to it at all. This log record is written only if the
transaction has two or more resources (2PC transaction). It doesn't
appear that you are using more than one resource in the transaction.
If you are using 2PC transaction and want to validate if any data is
written to the txn_log_table, then try putting some load and then you
will be able to see some entries in the table.

regards
sankar



Wang.Qiang wrote:
> Hi,all
>
> I am writing a application to test Transaction Logging, and I want to
> store Transaction Logs in a Database(Derby) by following steps
>
> 1. Create a JDBC connection Pool and set the
> non-transactional-connections attribute to true.
>
> 2. Create a JDBC resource name of jdbc/myds that uses the connection
> pool and note the JNDI name of the JDBC resource.
>
> 3. Create a table named txn_log_table with the schema:
> create table txn_log_table(localtid bigint,servername varchar(40),gtrid
> char(70) for bit data)
>
> 4. Add the db-logging-resource property to the transaction service.
> asadmin set
> server.transaction-service.property.db-logging-resource="jdbc/myds"
>
> 5. To disable file synchronization, use the following asadmin
> create-jvm-options command:
> asadmin create-jvm-options -Dcom.sun.appserv.transaction.nofdsync
>
> 6. Restart the server
>
> 7.deloy the application into default server
> ** all above steps are configed in the glassfish default server
>
> my application use toplink to persist a entity to database
> EJB code like this
>
> @Stateless(name="myejb",mappedName="ejb/myejb")
> public class MyBeanImpl implements MyBean {
> @PersistenceContext(unitName="myunit")
> private EntityManager manager;
>
> public void testInsert(String name, String sex) {
> MyEntity entity = new MyEntity();
> entity.setName(name);
> entity.setSex(sex);
> manager.persist(entity);
> }
> }
>
> Client to invoke the ejb.
> the result is the entity is correct insert into the database,
> but,I go to check the txn_log_table in the database,
> the 'txn_log_table' table does not have any data.
> I think txn_log_table will record this transaction.
> I don't know why?
> Could you help me?
>
> Thanks in advance
> Wang
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>