Results 1 to 2 of 2
  1. #1
    tedy2808 is offline Member
    Join Date
    Aug 2010
    Rep Power

    Exclamation How to log error in sql to log file

    Hi guys, I quite new to java and not really good in it..
    I need you guys to guide me on this...I need to upgrade a system that using java in linux. My question is,let say there are errors occur in database, i need the error message to be logged/recorded in a log file and send email to people in recipient list.Thus, below are the example when there are error in my db..

    Exception in thread "main" java.sql.SQLException: ORA-00001: unique constraint (PIN.I_RESELL_ORG_CODE) violated
    at oracle.jdbc.driver.DatabaseError.throwSqlException (
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe
    at oracle.jdbc.driver.T4C8Oall.receive( 742)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4
    at oracle.jdbc.driver.T4CPreparedStatement.executeFor Rows(
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(
    at oracle.jdbc.driver.OraclePreparedStatement.execute Internal(
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(
    at Popular.<init>(
    at Popular.main(

    do i have to install any logging packages? or only create simple java script for it?

    Seriously, i have no idea as i never encountered this situation..Really need someone to guide me on this.:confused:Thanks in advanced.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    Look up log4j as a start point.
    You'll need to read up on how to set it up properly.

Similar Threads

  1. Replies: 6
    Last Post: 02-10-2011, 10:55 AM
  2. Error While Opening A PDF file
    By Cluster Storm in forum AWT / Swing
    Replies: 6
    Last Post: 06-07-2010, 06:03 PM
  3. Jar file error. Please help!
    By x2robbie2x in forum New To Java
    Replies: 1
    Last Post: 02-11-2010, 04:19 AM
  4. Error during file open
    By in forum Advanced Java
    Replies: 1
    Last Post: 10-14-2008, 02:26 PM
  5. error while running jar file
    By ernieBob in forum NetBeans
    Replies: 1
    Last Post: 03-25-2008, 12:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts