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

    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 (DatabaseError.java:111)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:330)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:287)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java: 742)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4 CPreparedStatement.java:212)
    at oracle.jdbc.driver.T4CPreparedStatement.executeFor Rows(T4CPreparedStatement.java:951)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:1159)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Internal(OraclePreparedStatement.java:3284)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePreparedStatement.java:3367)
    at Popular.<init>(Popular.java:94)
    at Popular.main(Popular.java:117)


    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
    Posts
    11,953
    Rep Power
    19

    Default

    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, 09: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, 03:19 AM
  4. Error during file open
    By helloamitk@gmail.com 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, 11:13 AM

Posting Permissions

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