SQl statement cause extreme Portal log growth

Our Portal server log file is growing very fast (30 - 50 Mb per minute). When examining the log file we see that the log file does contain only the error messages:
#1.5#00096BF521750058005A9CA900001E480003E80BD8A2C263#1099562506968#/System/Database/sql/jdbc/common#sap.com/irj#com.sap.sql.jdbc.common.StatementAnalyzerImpl#Guest#18####655e44612e4811d9b41300096bf52175#Thread[ThreadPool-Dispatcher,5,SAPEngine_Application_Thread[impl:3]_Group]##0#0#Error#1#com.sap.sql.jdbc.common.StatementAnalyzerImpl#Java#com.sap.sql.jdbc.common_1123#com.sap.sql.log.OpenSQLResourceBundle#The SQL statement "" contains the semantics error[s]: #2#SELECT MIN("ID"),"PRIORITY" FROM "KMC_TQ_QUEUE" WHERE "NAMESPACE_HASH" = ? AND "NAMESPACE" = ? AND "TASK_STATE" = 1 GROUP BY "PRIORITY" ORDER BY 2 DESC#type check error: the expression >>"NAMESPACE"<< (LONGVARCHAR) is not comparable and must not be used with "="
This message occurs more than 500 times per log file. It has something to do with Knowledge management, but we cannot find anything that triggers this sql statement.
Any ideas?
Noel Hendrikx & Pascal Rijnart

SAP tells us in reaction to our customer message:
"The table's definition is correct. What has to be changed is the
computed type for field NAMESPACE and the generated file for the table.
As I wrote before, if you make any change in the field NAMESPACE the
new computation is started (so change the description which has no
effect on the table's version on the database). Make the change and
save the table in the SapNetWeaver Developer Studio. You will then
see that the field's JDBC-type changes to VARCHAR.
Choose 'Create archive' for Dictionary Project the table belongs to
and deploy the sda on the database. Both can be done in the studio."
Can anyone tell us what to do now?
Noel Hendrikx

Similar Messages

  • IPhones using activesync causing excessive transaction log growth on Exchange 2010

    Hi there.
    We have around 60 iPhone or iPad users who are retrieving their emails from our Exchange 2010 SP2 servers using activesync.
    Back when everyone was using the 3GS this worked just fine but late in 2011 we noticed that the transaction logs on our exchange servers were growing out of control. They should be roughly two times the volume of emails sent or received but all of a sudden we were getting fourty times as many! We only send just over 1GB of emails per week but have 50GB of transaction logs in that time.
    I've spent ages trying to track down the cause and have an open TAC case with Microsoft that's been dragging on for several months now. We have recently proved that it's activesync causing the log growth - disable it and everything returns to normal - but they don't seem to be in any rush to identify a fix and I suspect their answer will be "Stop using iPhones".
    Has anyone else seen this behaviour before and if so did you find a fix?
    I was hoping iOS 6 might provide a solution but I'm reluctant to get everyone to upgrade because of the well publicised problems with maps and now I see that there are different Activesync bugs involving cancellation of meeting requests.
    Anyone who can provide me with a resolution will win a prize as I'm at my wits end here.
    Thanks

    I have seen the issue twice in two weeks.  Two different users, the commonality is both an iphone, and an ipad.  In both cases the ipad was on wifi.  I was able to turn on device logging in the ECP and in 20 minutes captured over 1 MB log on i-pad.  I disabled the i-pad via the ecp and issue disipated.
    When I reviewed the log the content that was being sync'd was over 5 months old.  I instructed the user to back off to 30 days.  Device is still stable, and the 30 days is just a temporary solution.  I have opened a case with Microsoft for further review of the session log.  What is interesting is that the log is consumed with a particular fetch and message class:  ipm.note.eas  <- EAS is the Exchange Archiving System stub created by Zantaz.  I confirmed with our admin that we did not do any sync on the EAS server.  I am looking into if the User initiated an Outlook resync of stubs.
    <Fetch>
         <ServerId>8:19930</ServerId>
         <Status>1</Status>
         <ApplicationData>
          <To xmlns="Email:" bytes="50"/>
          <From xmlns="Email:" bytes="35"/>
          <Subject xmlns="Email:" bytes="18"/>
          <DateReceived xmlns="Email:">2012-08-26T04:01:29.964Z</DateReceived>
          <DisplayTo xmlns="Email:" bytes="16"/>
          <ThreadTopic xmlns="Email:" bytes="14"/>
          <Importance xmlns="Email:">1</Importance>
          <Read xmlns="Email:">0</Read>
          <Body=4502 bytes/>
          <MessageClass xmlns="Email:">IPM.Note.EAS</MessageClass>
          <InternetCPID xmlns="Email:">1252</InternetCPID>
          <Flag xmlns="Email:"/>
          <ContentClass xmlns="Email:">urn:content-classes:message</ContentClass>
          <NativeBodyType xmlns="AirSyncBase:">3</NativeBodyType>
          <ConversationId xmlns="Email2:">BEF20C7413954F8DAC2C558F7AE26FF0</ConversationId>
          <ConversationIndex xmlns="Email2:">CD8206EA510011DCEC00FFFF9F122F8002B86D80</ConversationIndex>
          <Categories xmlns="Email:"/>
         </ApplicationData>
        </Fetch>
    device details:
    Device OS:
    iOS 6.0.1 10A523
    Device language:
    en
    User agent:
    Apple-iPhone4C1/1001.523
    Device OS:
    iOS 6.0.1 10A523
    Device language:
    en
    User agent:
    Apple-iPad3C2/1001.523

  • SQL Statement cause delay on exceptional days to run

    Hi ,
    We are running the same sql statement on daily basis.
    5 days a week, it gets completed in 10 mins and once or, twice in a week , it takes 7 – 10 Hrs to execute.
    what are the tuning methods and steps we can apply to know the real culprits.
    Regards
    Asif

    Before you dive into reading books and other stuff, you can simply look at the execution plan of your Statement on SQL*PLUS.
    It's very easy, just do the following with your SQL Statement on both cases when it takes 10 minutes and hours and compare the results.
    DEV@TEST>
    DEV@TEST> SET AUTOTRACE TRACEONLY
    DEV@TEST>
    DEV@TEST> SET TIMING ON
    DEV@TEST>
    DEV@TEST> SELECT * FROM USER_OBJECTS;
    105 rows selected.
    Elapsed: 00:00:00.01
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=146 Card=1620 Byte
              s=259200)
       1    0   VIEW OF 'USER_OBJECTS' (VIEW) (Cost=146 Card=1620 Bytes=25
              9200)
       2    1     UNION-ALL
       3    2       FILTER
       4    3         TABLE ACCESS (FULL) OF 'OBJ$' (TABLE) (Cost=146 Card
              =1731 Bytes=136749)
       5    3         TABLE ACCESS (BY INDEX ROWID) OF 'IND$' (CLUSTER) (C
              ost=2 Card=1 Bytes=8)
       6    5           INDEX (UNIQUE SCAN) OF 'I_IND1' (INDEX (UNIQUE)) (
              Cost=1 Card=1)
       7    2       TABLE ACCESS (BY INDEX ROWID) OF 'LINK$' (TABLE) (Cost
              =0 Card=1 Bytes=88)
       8    7         INDEX (RANGE SCAN) OF 'I_LINK1' (INDEX) (Cost=0 Card
              =1)
    Statistics
              0  recursive calls
              0  db block gets
            726  consistent gets
              0  physical reads
              0  redo size
           8804  bytes sent via SQL*Net to client
            574  bytes received via SQL*Net from client
              8  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
            105  rows processed
    DEV@TEST>You should have an idea why there's a difference in execution time by comparing the results.
    Regards,
    Tony Garabedian

  • Sql statement causes my JRun server to fail.

    I'm beginning JSP and can't go through this recurrent error: the first request to the JSP page containing sql statement works well, in the second, an error occurs and finally, the third forces my Jrun server to fail with a stack error...
    <CODE>
    <%-- page global declaratiosn --%>
    <%@ page import="java.sql.*,javax.sql.*,allaire.taglib.*" %>
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
    String url = "jdbc:odbc:ademeregion" ;
    Connection con = DriverManager.getConnection( url , "" , "" ) ;
    Statement stmt = con.createStatement();
    ResultSet itom = stmt.executeQuery( "SELECT * FROM ITOM" ) ;
    ResultSetMetaData itomMetaData = itom.getMetaData( ) ;
    out.print( getServletContext().getInitParameter( "test" ) + "<br>" ) ;
    %>
    <table border=1 cellspadding=0 cellspacing=0>
    <%
    while( itom.next() ){%>
    <tr>
    <%
    for (int i = 1 ; i <= itomMetaData.getColumnCount() ; i++ ){
    out.print( "<td><font face=Verdana color=#EEEEEE size=1>" + itom.getString( i ) + "</font></td>") ;
    %>
    </tr><%
    %>
    </CODE>
    I assume it could be a typical jdbc problem that beginners encounter...
    Help required...
    Thanks a lot...
    Sylvain

    Thnks but it's allready done:
    I had the following code allready:
    <%
    itom = null ;
    itomMetaData = null ;
    stmt.close( ) ;
    con.close( ) ;
    %>
    But thanks anyway...

  • FDM-generated SQL statement in log file?

    Hello all, hopefully a simple question:
    When you perform an import using FDM, I know that behind the scenes a SQL SELECT statement is composed and executed against the database server. My question: is the actual SQL statement kept in a log somewhere (so that we can see it?) In our case it's an Oracle DB server and we're using the ERPI Adapter; not sure if that's relevant. We would like to grab that SQL statement and use it as a jumping-off point for some other things.
    Thanks in advance for anything you can offer.

    The SQL Statement is not written to the log for the adapter.  The only things that are logged are what show in the adapter log file if you enable loggin for the ERPi source adapter in the "Get Data" action.    

  • Can I capture the SQL statement cuasing an error?

    I have an error log that capures SQLCODE & SQLERRM.
    Can I also capture the actual SQL statement causing the error?

    there is also format call stack, format error stack and format error backtrace.
    /* Formatted on 6/21/2011 3:45:40 PM (QP5 v5.149.1003.31008) */
    BEGIN
       FOR c IN (SELECT TO_NUMBER ('hey Im not a number') FROM DUAL)
       LOOP
          NULL;
       END LOOP;
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.PUT_LINE ('SQLCODE :' || SQLCODE);
          DBMS_OUTPUT.PUT_LINE ('SQLERRM :' || SQLERRM);
          DBMS_OUTPUT.
           put_line (
             'call stack...' || CHR (10) || DBMS_UTILITY.FORMAT_call_STACK ());
          DBMS_OUTPUT.
           put_line (
             'Error_Stack...' || CHR (10) || DBMS_UTILITY.FORMAT_ERROR_STACK ());
          DBMS_OUTPUT.
           put_line (
                'Error_Backtrace...'
             || CHR (10)
             || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE ());
          DBMS_OUTPUT.PUT_LINE ('----------');
          RAISE;
    END;
    SQLCODE :-1722
    SQLERRM :ORA-01722: invalid number
    call stack...
    ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    c0000002a56b4248        11  anonymous block
    Error_Stack...
    ORA-01722: invalid number
    Error_Backtrace...
    ORA-06512: at line 2
    ----------

  • Adding a field to an sql statement in Oracle Reports error ORA-00933

    We have been requested to add a field that already exists in the table referred to by the sql statement in Oracle Reports Builder. The report was set up by a consultant about 3 yrs ago and we don't really have much skill in this area. What is happening when I try to modify the SQL statement, either adding a field or deleting a field to the SELECT statement, causes an error message preventing the statement from being saved. The only way out of the error message is to click Cancel. The error message is
    ORA-00933:SQL command not properly ended
    ORDER BY Program ==> NAME
    Even adding or deleting a space anywhere in the SQL statement causes the error (not adding any new fields). A coworker found that if we comment out the ORDER BY, the statement will accept the new field in the SELECT section, however then we lose the order by functionality. I would like to add one additional field before the FROM. Not sure if any additional data are needed. Thank you.
    SELECT p.person_uid PIDM_KEY, p.id_number ID,
                   p.full_name_lfmi name,            
                    p.BIRTH_DATE, p.GENDER Sex,
                    Decode(a.residency,'D',p.Primary_ethnicity,'F')  Ethn,
                    a.academic_period TERM,        
                    CASE WHEN :p_group_by = 'PROGRAM' THEN a.program
                                 ELSE ' '
                    END AS Program,
                    a.COLLEGE, a.degree, a.major, ' ' rule,
                    a.STUDENT_POPULATION,a.STUDENT_LEVEL,    a.application_status Status,  a.application_status_date app_sts_dte,
                    ad.decision_date1 Last_Dec_Date,
                    ad.decision1||' '||ad.decision2||' '|| ad.decision3||' '|| ad.decision4||' '|| ad.decision5 Decisions,
                    /*  Deposit Date uses the last term entered in :p_term parameter string */
                    (SELECT MAX(deposit_effective_date) FROM usf_as_deposit WHERE account_uid = a.person_uid &term_clause group by account_uid)   AS "DEPOSIT DATE",     
                    ph.phone as PHONE,
                    CASE WHEN PS.FIRST_CONTACT IN ('NET','PAP','COM','COP') THEN PS.First_Contact
                     ELSE CASE WHEN ps.latest_contact IN ('NET','PAP','COM','COP') THEN PS.Latest_Contact
                                ELSE '  '
                                END
                    END AS FIRST_CONTACT,
                    DECODE(:p_address,'Y',REPLACE(adr.street1||' '||adr.street2||' '||adr.street3||' '||adr.city||','||adr.state||' '||adr.nation||' '||adr.zip,'  ',' '),' ') as  address, adr.nation, adr.state,
                    goremal_email_address email, a.residency, a.application_date, p.primary_ethnicity, c.cohort
    FROM MST_ADMISSIONS_APPLICATION A,
               MST_PERSON p,mst_pre_student PS,  Admissions_Cohort c, usf_v_phone_pr_ma ph,
               MST_admissions_decision_slot AD, usf_v_email, usf_v_address_dr_lr_ma_pr adr
    WHERE a.PERSON_UID = p.person_uid
            AND a.curriculum_priority  = 1
            AND a.person_uid = ps.person_uid
           AND a.person_uid = ad.person_Uid(+)
           AND a.person_uid = goremal_pidm(+)
           AND a.person_uid = adr.pidm(+)
           AND a.person_uid = ph.pidm(+)
           AND ph.rnum(+) = 1
           AND a.person_uid = c.person_uid(+)
           AND a.academic_period = c.academic_period(+)
      &Where_Clause
           /*    TAKE OUT FOLLOWING LINE AFTER DATA IS CLEANED UP  */
            AND NOT(p.id_number = '00000000'   OR SUBSTR(p.id_number,1,1) = 'B'  OR UPPER(p.full_name_lfmi)  LIKE '%TESTING%')
           AND  a.application_status_date >= NVL(:p_as_of_date,sysdate-8000)
           AND a.academic_period = ad.academic_period(+)
            AND a.application_number = ad.application_number(+)
            AND a.degree <> 'ND'    /*   AND a.college <> 'LW'                         --  Does not need non-degree and law students    */
           &Cohort_Clause 
    ORDER BY Program  &ORDER_CLAUSE

    Hi Denis,
    I tried your suggestion. The good thing is that adding the comma allowed me to be able to add a.campus to the select statement, unfortunately, another error message happened.
    ORA-00936: missing expression SELECT p . person_uid PIDM_KEY ,
    p . id_number , p . full_name_lfmi name , p . BIRTH_DATE , p . GENDER Sex ,
    Decode ( a . residency , 'D' , p . Primary_Ethnicity , 'F' ) Ethn , a . academic_period TERM ,
    CASE WHEN : P_group_by = 'PROGRAM THEN a I started over and tried only putting in the comma and get the same message even though I didn't add campus. After that, removed the comma which led to the ORA-00933 error message. So once again, I had to close the file without saving, in order for the report to run at all.

  • About hints in sql statements

    hi,
    can you plz provide any best sides for sql hints?

    Suri wrote:
    You can learn basics from below site.
    http://www.dbasupport.com/oracle/ora9i/index_hints.shtml
    What an awful article...
    >
    Using Index Hints in SQL statements - Cause we know more about our application than Oracle does
    Hints are used to give specific information that we know about our data and application, to Oracle. This further improves the performance of our system. There can be instances where the default optimizer may not be efficient for a certain SQL statements. We can specify HINTS with the SQL statements, to improve the efficiency of those SQL statements.
    <cut>
    By using Hints, you can improve certain SQL statements that might otherwise be inefficient.
    >
    That is just so wrong and completely misses the point.
    If a query is inefficient, then it can be down to poor database design, lack of statistics, lack of correct indexes (sometimes too many indexes), or poorly written SQL statements. Hacking an SQL statement with Hints to try and make it work better because you believe you "know more about our application than Oracle does", shows a complete lack of understanding of the internals of Oracle. Oracle doesn't need to know about the application, but it certainly does need to know about how the data is stored and related on the underlying tables and in the tablespaces and datafiles etc. and it's sure as hell got a better idea about that than any programmer, especially as it can change and adapt in the future as the data changes, which a programmers SQL statements (with fixed hints) won't.
    That article is a good example of the wrong attitude towards using hints. Thanks for posting that to demonstrate it.

  • ORA-01555 caused by SQL statement below - Kindly assist

    Hi,
    Version 9.2.0.7
    I have been getting lots of ORA-01555 error logged into my alert log since 10 hours ago, happening every second till now.
    The ORA-01555 is strange compared to those that have occured in my database before. From the error logged into the alert log, the statement is reflected as "table_4_200_c432_0_0_0". Any experts can advise what's exactly happening? The duration stated below seems really long.
    ORA-01555 caused by SQL statement below (Query Duration=1225798260 sec, SCN: 0x077a.e8ab9ae8):
    Tue Nov 4 19:31:00 2008
    table_4_200_c432_0_0_0
    thanks

    That event trace is helpful only when you are getting ORA-01555 in trace files without a query.
    Of course, you cannot get the diagnostic information for something that occurred in past (when diagnostics were not in place); so you have to wait till the next occurrence (if any) of ORA-01555 under similar conditions.

  • Jdbc adapter log sql statement to file

    Hi,
    I'm using a Proxy to Jdbc scenario.
    In the Adapter Configuration the logSQLStatement is set to true.
    Is it possible to log the sql statement shown in the Audit  to a file?
    Regards Ralf

    Hi
    please try the below query in Update sql statement
    update table_name set fieldname = systimestamp where .....
    or
    update table_name set fieldname = current_timestamp where .....
    Regards
    Ramg.

  • How to design SQL server data file and log file growth

    how to design SQL DB data file and log file growth- SQL server 2012
    if my data file is having 10 GB sizze and log file is having 5 GB size
    what should be the size in MB (not in %) of autogrowth. based on what we have to determine the ideal size of file auto growth.

    It's very difficult to give a definitive answer on this. Best principal is to size your database correctly in advance so that you never have to autogrow, of course in reality that isn't always practical.
    The setting you use is really dictated by the expected growth in your files. Given that the size is relatively small why not set it to 1gb on the datafile(s) and 512mb on the log file? The important thing is to monitor it on an on-going basis to see if that's
    the appropriate amount.
    One thing you should do is enable instant file initialization by granting the service account Perform Volume Maintenance tasks in group policy. This will allow the data files to grow quickly when required, details here:
    https://technet.microsoft.com/en-us/library/ms175935%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396
    Also, it possible to query the default trace to find autogrowth events, if you wanted you could write an alert/sql job based on this 
    SELECT
    [DatabaseName],
    [FileName],
    [SPID],
    [Duration],
    [StartTime],
    [EndTime],
    CASE [EventClass]
    WHEN 92 THEN 'Data'
    WHEN 93 THEN 'Log' END
    FROM sys.fn_trace_gettable('c:\path\to\trace.trc', DEFAULT)
    WHERE
    EventClass IN (92,93)
    hope that helps

  • What can be the cause of Web ADI error : Cannot execute SQL statement?

    I created a custom integrator in r12.2.3 and while loading I encountered an error, Cannot execute SQL statement.
    I checked my setup in Interface attribute , the RUN_ID column has a default type SQL QUERY with a default value SELECT  XXCONV_EAM_ASSET_NUM_S.NEXTVAL FROM DUAL.
    If I have a right setup here, what can be the cause of this error?

    Hi,
    The possibilities can be of various reasons, with the sql statements,
    xml descriptors, data sources, improper drivers anything. To crack down
    the solution, kindly let me know the error messages and what exactly are
    you trying to accomplish.
    Thanks & Regards
    Raj
    manimaran t wrote:
    what may be the cause of this error java.sql.SQLException: invalid sql
    type passed to callable statement in iplanet ussing JNDI
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • ORA-01555 caused by SQL statement below on production

    Hi
    i got ORA-01555 caused by SQL statement below on my prodution adn database undo_retention = 18000 what can i do my database performance is going down pls tail me what i do .
    Regards
    Digvijay

    1) I don't see a SQL statement here
    3) How did you determine that UNDO_RETENTION of 18000 was appropriate?
    4) How much UNDO is your system generating?
    6) Do you believe this is related to your performance problems? If so, why do you believe that?
    At the risk of stating the obvious... You've told Oracle to try to maintain UNDO for 18,000 seconds (5 hours). You have a query that runs for roughly 6.25 hours. If, after running for 6.25 hours, that query needs a block that was modified, say, 6 hours ago, it may not find it because you've told Oracle you don't need it any longer.
    Your UNDO_RETENTION needs to be greater than the longest-running query you expect to run. You can bump up UNDO_RETENTION if you'd like. However, I tend to believe that a query that died after 6.25 hours is probably a query that is in desparate need of tuning. If you reduce the query runtime to something less than 5 hours, you could keep UNDO_RETENTION at the current setting.
    Justin

  • Keep log sql statement

    Dear all,
    Is there any ways to keep log sql statement after insert,update,delete as the example below :
    ==========================================
    user01     client01     prog01.exe     update emp set name='test';
    user02     client02     prog02.exe     delete from emp1;
    I 'm not sure.Can use trigger? Is anybody have the example code?
    Oracle9i + windows2000
    Thank you for advance
    Chara

    Hi,
    Here is a small resumen About Basic Auditing in Oracle.
    For any Oracle versions prior to 9i you will need to set audit_trail parameter in the pfile ie.g.:
    audit_trail = DBFor later Oracle Versions:
    SQL>alter system set audit_trail = DB;To enable auditing for a specific object run the following command:
    SQL>AUDIT SELECT, INSERT, UPDATE, DELETE ON SCHEMA.TABLE;To stop auditing use:
    SQL>NOAUDIT SELECT, INSERT, UPDATE, DELETE ON SCHEMA.TABLE;Or to audit any statement that queries, delete, insert or updates any table, issue the following statement:
    SQL>AUDIT SELECT TABLE, DELETE TABLE, INSERT TABLE, UPDATE TABLE;If you want to audit a specific user will need to run the following commands:
    SQL>AUDIT ALTER TABLE, SELECT TABLE, INSERT TABLE, … ,GRANT PROCEDURE by <USERNAME>;To stop the audit for the user you will need to run:
    SQL>NOAUDIT ALTER TABLE, SELECT TABLE, INSERT TABLE, … ,GRANT PROCEDURE by <USERNAME>;To see the results of the auditing use please run:
    SQL> select * from dba_audit_trail;This is an excellent Oracle documentation to learn how to implement it:
    - http://download-uk.oracle.com/docs/cd/B19306_01/network.102/b14266/cfgaudit.htm
    Also I’ll recommend you to take a look on the following links:
    - http://www.oracle-base.com/articles/8i/Auditing.php
    Cheers,
    Francisco Munoz Alvarez
    http://www.oraclenz.com

  • Log for all the sql statement executed

    Hi,
    I would like to know how to see the log for all the sql statement executed starting from connection to all the database related actions.
    Is it something that i need to set it up in the driver?
    I'm using Tomcat and JDBC driver.
    Please reply.
    Thanks,
    Anjana

    Make your own.
    Calendar cal = new GregorianCalendar();
    int year = cal.get(Calendar.YEAR);
    int month = cal.get(Calendar.MONTH) + 1;
    int day = cal.get(Calendar.DAY_OF_MONTH);
    //use calendar object to get other infos such as time of query
    //append your query string
    File f  =new File ("c:\\jakarta-tomcat-3.2.4\\webapps\\ASD\\LOGS\\log" + df.format(day) + df.format(month) + year + ".txt");
                   if (! f.exists())
                        f.createNewFile();
                   FileWriter fw = new FileWriter (f, true);
                   // append new log to end of file
                   fw.write(buf.toString());
                   fw.write("\n");
                   fw.flush();
                   fw.close();
              catch (IOException ioe)
                   System.out.println(ioe.toString());

Maybe you are looking for