• Post Reply Bookmark Topic Watch Topic
  • New Topic

View SQL statements generated by WebSpere App Server

 
Vaibhav Naikwade
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I wanted to view\log SQL statements generated/fired to database server from WebSpere App Server 7.0 at runtime. I am new to EJB world. I want something similar to show_sql=true of hibernate config feature to analyse how WebSpere generated sqls for CMP beans.

Any help or pointers are greatly appreciated.
 
Daniel Del Moral
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Try adding this lines in your persistence.xml file that should be inside de META-INF folder:


 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel,
He's using entity beans, not Hibernate.

Vaibhav,
If you look at the generated code, it contains the SQL statements. There are also JDBC drivers that log SQL statements. They are meant for JDBC, but I think they would still work for CMPs because they generate JDBC behind the scenes.
 
Vaibhav Naikwade
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Daniel and Jeanne.

Just to clarify; I am using WAS7.0 as my app server; I have CMP beans which are doing CRUD operations, for this its obvious it must be generating sql statements behind the scene.
I wanted to know that is there any configuration parameter in ejb-jar.xml or WAS profile which enable me to log these sqls in log file. I am not able to analyse what CMP beans are doing behind the scenes. I am used to hibernate and know how to turn on sql logging just by setting hibernate.show_sql parameter. I want similar feature for EJB CMP beans.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vaibhav,
I don't think there is a setting. A logging JDBC driver could intercept the statements and log them, but it still isn't one property.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!