aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Log SQL Statement... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Log SQL Statement..." Watch "Log SQL Statement..." New topic
Author

Log SQL Statement...

Tejas V Shah
Greenhorn

Joined: Mar 20, 2008
Posts: 20
Hi Everybody,
Can you help me how to log SQL statement
I am using EJB3.0

Thanks in Advance
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14432
    
  23

This does not belong in the Sun Certification Results forum. Please choose a more appropriate forum next time you ask a question.

I'll move this one to a more appropriate forum.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31069
    
232

Originally posted by Tejas V Shah:
HCan you help me how to log SQL statement

Log it where? Can you elaborate?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Tejas V Shah
Greenhorn

Joined: Mar 20, 2008
Posts: 20
Originally posted by Jeanne Boyarsky:

Log it where? Can you elaborate?


Temporary consider I want to log it in my local host
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
By "localhost" I'm assuming you mean the client host and not the server.

The SQL is happening on the server and that's where you'd want to log it.

You can log it in a million ways, but a common way is to use the log4j package.

You can create a logger for the class you want, and log the query as INFO.

google "log4j" and you find a myriad of resources, if you have any specific questions once you start using it, "Java in General (intermediate)" is likely an appropriate forum to ask
[ May 19, 2008: Message edited by: Bill Shirley ]

Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Log SQL Statement...