Writing into a remote file using URL.

     URL url = new URL("http://144.16.241.110:9090/b.txt");
     URLConnection connection = url.openConnection();
     connection.setDoOutput(true);
     PrintWriter out=new PrintWriter(new BufferedOutputStream(connection.getOutputStream()));
     Writer out =(new BufferedWriter(new OutputStreamWriter(connection.getOutputStream())));
     out.flush();
     out.write('d');
     out.close();
I am using the following code to write into that file.
This is compiled and no error comes while compiling.
But while running I get the following.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>405 Method Not Allowed</TITLE>
</HEAD><BODY>
<H1>Method Not Allowed</H1>
The requested method POST is not allowed for the URL /b.txt.<P>
<HR>
<ADDRESS>Apache/1.3.12 Server at 144.16.241.110 Port 9090</ADDRESS>
</BODY></HTML>
How to rectify this.Thanx in advance.
I am able to read from the same file.

Thanx
Is it possible to set permission to a remote file
using our program? If so give me some sample code.

Similar Messages

  • Problem in writing into the excel file using java code

    Hai ,
    I will be getting the data as a string and i am writing into the excel file. the problem is .if it has numeric values even now i will writing as a string data ,at this time i am getting the message in the excel file as "Number in the cell is formatted as text".
    I need to remove this thru my code..but i can write only as a string .
    To write in a excel file ,i used HSSFWorkbook.

    just check out
    http://www.andykhan.com/

  • Problem in reading no. of files and writing into a single file

    Hi,
    Iam with Problem in reading no. of files and writing into a single file....
    Iam reading no. of files stored in local directory.......
    Iam able to read and print the data in files successfully....but while writing..only first file is being written...and the next files are not written in my output file...
    plz tell me my mistake....I hope Iam doing some mistake while writing into file...PLz help.....
    Basically my code structure is like this....
    import java.io.*;
    import java.util.regex.*;
    import java.util.*;
    import java.text.*;
    import org.apache.poi.poifs.filesystem.POIFSFileSystem;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    class Writing {
    public static void main(String args[]) throws Exception {
              FileOutputStream fileOut = new FileOutputStream("ServerResult.xls"); //my output file
              int counter = 1;
              File dir = new File("C:/Perform/ServerLogs");
              String[] children = dir.list();
              if( children == null)
                   System.out.println("The Directory mentioned does not exist");
              else {
                   for (int fileNo = 0; fileNo < children.length; fileNo++ ) {        //Files iteration starts
                        String filename = children[fileNo];
              File logFile = new File(filename);
    FileReader logFileReader = new FileReader(logFile);
    BufferedReader logReader = new BufferedReader(logFileReader);
    StringBuffer sBuf = new StringBuffer(5000);
              HSSFWorkbook wb = new HSSFWorkbook();          
              HSSFSheet sheet = wb.createSheet();
              HSSFRow rowTitle;
              HSSFRow rowReq;
              HSSFRow rowRes;
    String aLine = null;
    boolean skip = false;
    boolean readed = false;
    boolean initReq = false;
              boolean flag = false;
    long requestTime = 0;
    long responseTime = 0;
    long recdTime = 0;
    long sentTime = 0;
              long hasTime = 0;
              long presentTime = 0;
              int hasCalls = 0;
    Pattern startMessage = Pattern.compile("^<MESSAGE.*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
    Pattern requestMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"RequestMsg.\".*ID=\".*_"+args[0]+"\".*<ActName>(.*)</ActName>.*", Pattern.DOTALL);
    Pattern requestMessage1 = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"RequestMsg.\".*ID=\".*_"+args[0]+"\".*<Svc id=\"(.*)\">.*", Pattern.DOTALL);
    Pattern responseMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"ResponseMsg\".*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
    Pattern initMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"HostConnInit\".*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
    Pattern initResMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"ResponseMsg\".*ID=\"null\".*", Pattern.DOTALL);
    Pattern initResIDMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"ResponseMsg\".*ID=\"null\".*<IATA>"+args[0]+"</IATA>.*", Pattern.DOTALL);
              Pattern sentMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"DCMsgSentInfo\".*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
              Pattern rcvdMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"DCMsgRcvdInfo\".*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
    DecimalFormat dcf = new DecimalFormat("########.##");
    String actName = "";
              if (fileNo ==0)
              rowTitle = sheet.createRow((short)0);
              rowTitle.createCell((short)0).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)0).setCellValue("Req/Res");
              rowTitle.createCell((short)1).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)1).setCellValue("Action");
              rowTitle.createCell((short)2).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)2).setCellValue("Server Time(in ms)");
              rowTitle.createCell((short)3).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)3).setCellValue("Request Vs Response Time in Server(in ms)");
              rowTitle.createCell((short)4).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)4).setCellValue("Time Taken By HAS/HOST(in ms)");
              rowTitle.createCell((short)5).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)5).setCellValue("No. of HAS calls");
              rowTitle.createCell((short)6).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)6).setCellValue("Data Size");
              //wb.write(fileOut);
    while((aLine=logReader.readLine()) != null) {
    if(aLine.startsWith("<MESSAGE TYPE=\"EVENT\"")) {
    Matcher m = startMessage.matcher(aLine);
    if(m.find()) {
    sBuf.setLength(0);
    sBuf.append(aLine);
    skip = false;
    initReq = false;
    m = initMessage.matcher(aLine);
    if(m.find()) {
    initReq = true;
    } else {
    if(initReq) {
    m = initResMessage.matcher(aLine);
    if(m.find()) {
    sBuf.setLength(0);
    sBuf.append(aLine);
    skip = false;
    } else if(aLine.startsWith("</MESSAGE>")) {
    if(!skip) {
    sBuf.append(aLine);
    readed = true;
    } else if(!skip){
    sBuf.append(aLine);
    if(!skip && readed) {
    String tempStr = sBuf.toString();
    if(tempStr.length() > 0) {
    boolean reqMatched = false;
    Matcher m = null;
    if(initReq) {
    m = initMessage.matcher(tempStr);
    actName = "Intialization";
    } else {
    m = requestMessage.matcher(tempStr);
    String time = "";
    if(m.find()) {
    reqMatched = true;
    for (int i=1; i<=m.groupCount(); i++) {
    String groupStr = m.group(i);
    if(i == 1) {
    time = groupStr;
    } else if(i == 2) {
    actName = groupStr;
    } else if(!initReq){
    m = requestMessage1.matcher(tempStr);
    if(m.find()) {
    reqMatched = true;
    for (int i=1; i<=m.groupCount(); i++) {
    String groupStr = m.group(i);
    if(i == 1) {
    time = groupStr;
    } else if(i == 2) {
    actName = groupStr;
    if(time.length() > 0 ) {
    try{
    requestTime = sdf.parse(time).getTime();
    }catch(Exception ex){}
    System.out.println("Request,"+actName+","+time+",,,,"+dcf.format(((double)time.length()/1024.0))+"K");
                                  //bw.write("Request,"+actName+","+time+",,,,"+dcf.format(((double)time.length()/1024.0))+"K");
                                  String reqDataSize = dcf.format(((double)time.length()/1024.0))+"K" ;
                                  rowReq = sheet.createRow((short)counter);
                                       rowReq.createCell((short)0).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)0).setCellValue("Request");
                                       rowReq.createCell((short)1).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)1).setCellValue(actName);
                                       rowReq.createCell((short)2).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)2).setCellValue(time);
                                       rowReq.createCell((short)3).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)3).setCellValue("");
                                       rowReq.createCell((short)4).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)4).setCellValue("");
                                       rowReq.createCell((short)5).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)5).setCellValue("");
                                       rowReq.createCell((short)6).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)6).setCellValue(reqDataSize);
                                       counter = counter +1;
                                       System.out.println("counter is "+counter);
                             Matcher l = sentMessage.matcher(tempStr);
                             Matcher k = rcvdMessage.matcher(tempStr);
                   if(l.find()) {
                                            for (int i=1; i<=l.groupCount(); i++) {
         String groupStr2 = l.group(i);
    try{
    sentTime = sdf.parse(groupStr2).getTime();
    }catch(Exception ex){}
                        if(k.find())
                                                 for(int j=1;j<=k.groupCount(); j++) {
                                                 String groupStr1 = k.group(j);
                                                 try{
    recdTime = sdf.parse(groupStr1).getTime();
    }catch(Exception ex){}
                                                 presentTime = (recdTime - sentTime);
                                                 hasTime = hasTime + presentTime;
                                                 hasCalls = hasCalls +1;
    if(!reqMatched) {
    if(initReq) {
    m=initResIDMessage.matcher(tempStr);
    } else {
    m=responseMessage.matcher(tempStr);
    if(m.find()) {
    for (int i=1; i<=m.groupCount(); i++) {
    String groupStr = m.group(i);
    try{
    responseTime = sdf.parse(groupStr).getTime();
    }catch(Exception ex){}
                                                 String resDataSize = dcf.format(((double)tempStr.length()/1024.0))+"K" ;
                                                 rowRes = sheet.createRow((short)(counter));
                                                 rowRes.createCell((short)0).setCellType(HSSFCell.CELL_TYPE_STRING);
                                                 rowRes.createCell((short)0).setCellValue("Response");
                                                 rowRes.createCell((short)1).setCellType(HSSFCell.CELL_TYPE_STRING);
                                                 rowRes.createCell((short)1).setCellValue(actName);
                                                 rowRes.createCell((short)2).setCellType(HSSFCell.CELL_TYPE_STRING);
                                                 rowRes.createCell((short)2).setCellValue(groupStr);
                                                 rowRes.createCell((short)3).setCellType(HSSFCell.CELL_TYPE_NUMERIC);
                                                 rowRes.createCell((short)3).setCellValue((responseTime - requestTime));
                                                 rowRes.createCell((short)4).setCellType(HSSFCell.CELL_TYPE_NUMERIC);
                                                 rowRes.createCell((short)4).setCellValue(hasTime);
                                                 rowRes.createCell((short)5).setCellType(HSSFCell.CELL_TYPE_NUMERIC);
                                                 rowRes.createCell((short)5).setCellValue(hasCalls);
                                                 rowRes.createCell((short)6).setCellType(HSSFCell.CELL_TYPE_STRING);
                                                 rowRes.createCell((short)6).setCellValue(resDataSize);
                                                 hasTime = 0;
                                                 hasCalls = 0;
                                                 counter = counter + 1 ;
    sBuf.setLength(0);
    readed = false;
              wb.write(fileOut);
              } // End of for (int fileNo = 0; fileNo < children.length; fileNo++ )
    }     //End of else
              fileOut.close();
    } //End of public static void main
    } // End of Class

    First of all, use [code]-tags to make your code readable, please.
    I didn't do a complete inspection of your code (because it's too much and unreadable as it is) and I don't know POI, but creating a new HSSFWorkbook for each input file sounds fishy to me ... try re-using the workbook and just creating a new sheet in each iteration.

  • Capturing EPC error List into a local file using BDC

    Can anyone let me know the Code for downloading the EPC check Results into a local File using BDC...[<b></b>

    You can use the function module
    EXTENDED_PROGRAM_CHECK to get the errors and warnigs of a epc for a program.
    then you can download that internal table information using GUI_DOWNLOAD fm.
    Regards,
    Ravi

  • How to convert a HTML files into a text file using Java

    Hi guys...!
    I was wondering if there is a way to convert a HTML file into a text file using java programing language. Likewise I would also like to know if there is a way to convert any type of file (excel, power point, and word) into text using java.
    By the way, I really appreciated the help that you guys gave me on my previous topic on how to extract tests from a pdf file.
    Thank you....

    HTML files are already text files. What do you mean you want to convert them?
    I think if you search the web, you can find things for converting those MS Office files to text (or extracting text from them, as I assume you mean).

  • I want to import a MS Word Index into a .pdf file using Adobe Pro.  How do I do that?

    I want to import a MS Word Index into a .pdf file using Adobe Pro. It is for a book.  The book has been converted to a .pdf for printing, but it needs an Index for the last page of the book.  I tried to embed a new index (starting from scratch but no luck.  Any suggestions?  Thank you for your time.

    Now I want to search this "myArrayStrings.get(r)" in another file. How to do that?Store the returned String. Do the same thing you did to read the first file to read the second file (i.e. read it in line-by-line and store the lines in a list). Then check if that list contains the String you stored from the first list.
    E.g. (using your code):
    String name = myArrayStrings.get(r); // assuming r is initialized somewhere before this
    if ( otherList.contains( name ) ) { // assuming otherList is your second list
        // do something
    }

  • How to get DocSet property values in a SharePoint library into a CSV file using Powershell

    Hi,
    How to get DocSet property values in a SharePoint library into a CSV file using Powershell?
    Any help would be greatly appreciated.
    Thank you.
    AA.

    Hi AOK,
    Would you please post your current script and the issue for more effcient support.
    In addition, to manage document set in sharepoint please refer to this script to start:
    ### Load SharePoint SnapIn
    2.if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
    3.{
    4. Add-PSSnapin Microsoft.SharePoint.PowerShell
    5.}
    6.### Load SharePoint Object Model
    7.[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
    8.
    9.### Get web and list
    10.$web = Get-SPWeb http://myweb
    11.$list = $web.Lists["List with Document Sets"]
    12.
    13.### Get Document Set Content Type from list
    14.$cType = $list.ContentTypes["Document Set Content Type Name"]
    15.
    16.### Create Document Set Properties Hashtable
    17.[Hashtable]$docsetProperties = @{"DocumentSetDescription"="A Document Set"}
    18.$docsetProperties = @{"CustomColumn1"="Value 1"}
    19.$docsetProperties = @{"CustomColum2"="Value2"}
    20. ### Add all your Columns for your Document Set
    21.
    22.### Create new Document Set
    23.$newDocumentSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($list.RootFolder,"Document Set Title",$cType.Id,$docsetProperties)
    24.$web.Dispose()
    http://www.letssharepoint.com/2011/06/document-sets-und-powershell.html
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Problem while writing data on xls file using jxl API

    Hi,
    I am getting problem while writing data on excel file using jxl api.
    When i write data on file and all handles associated to the file are closed, file size increases but when i open the file nothing is written in it and when file is closed manually from excel window, file size decreased to its original that was before writing data.
    here is code:
              FileOutputStream os = new FileOutputStream(this.dirPath + this.fileName, true);
              WritableWorkbook this.workbook = Workbook.createWorkbook(os);
    after writing data following handler are closed:
    this.os.flush();
                        this.workbook.write();
                        this.workbook.close();
                        this.os.close();
                        this.os = null;
    can any body help me.
    Thanks in advance

    Err, I did help you. I did understand your problem; and I solved it for you. What was missing was that you apparently made no effort to understand what you were being told. Or even consider it. You just argued about it, as though you were the one with the solution, instead of the one whose code didn't work.
    And the other thing that was missing was the part where you said 'thank you' to me for solving your problem. Somewhat more appropriate than biting the hand that fed you, frankly. I do this for nothing, on my own gas, and it's extremely irritating when people keep asking about problems I have already solved for them. I am entitled to discourage that. It's part of making them more efficient actually.
    But it happens often enough that it also makes me think I'm just wasting my time. Probably I am.

  • How to scan more pages into one PDF file using hP inkjet 2515

    Dear friend 
    How to scan more pages into one PDF file using hP inkjet 2515 

    Dear friend 
    How to scan more pages into one PDF file using hP inkjet 2515 

  • Two different methods for downloading a file using URL...

    I was just wondering if someone could shed some light on whether I should be downloading files using java.net.URL or java.net.URLConnection
    Here are two ways that I have found to work (and yes I realize that one is outputting to a stream and the other is getting put into a StringBuffer):
          InputStream in = url.openStream();
          byte[] b = new byte[buffSize];
          fileOutStream = new FileOutputStream(fileToBeCreated);
          while ((bytesRead = in.read(b)) != -1){
            totalFileSize+=bytesRead;
            fileOutStream.write(b, 0, bytesRead);
          }and
          URLConnection _con = url.openConnection();
          in = new BufferedReader(new InputStreamReader(_con.getInputStream()));
          String inputLine;
          while ((inputLine = in.readLine()) != null){
              webPageStringBuff.append(inputLine+"\r\n");
          }In both of the above cases url is just a URL object that has already been instantiated with a valid URL.
    So, just to re-iterate, I realize that the output portion of this code is doing something different (i.e. writing to a stream as opposed to appending to a StringBuffer) but I would like to know whether there is any reason to choose using the URLConnection to get the stream as opposed to using the URL to get the stream.
    Thanks,
    Tim

    hi,
    try out the following code
    // Program: copyURL.java
    // Author: Anil Hemrajani ([email protected])
    // Purpose: Utility for copying files from the Internet to local disk
    // Example: 1. java copyURL http://www.patriot.net/users/anil/resume/resume.gif
    // 2. java copyURL http://www.ibm.com/index.html abcd.html
    import java.net.*;
    import java.io.*;
    import java.util.Date;
    import java.util.StringTokenizer;
    class copyURL
    public static void main(String args[])
    if (args.length < 1)
    System.err.println
    ("usage: java copyURL URL [LocalFile]");
    System.exit(1);
    try
    URL url = new URL(args[0]);
    System.out.println("Opening connection to " + args[0] + "...");
    URLConnection urlC = url.openConnection();
    // Copy resource to local file, use remote file
    // if no local file name specified
    InputStream is = url.openStream();
    // Print info about resource
    System.out.print("Copying resource (type: " +
    urlC.getContentType());
    Date date=new Date(urlC.getLastModified());
    System.out.println(", modified on: " +
    date.toLocaleString() + ")...");
    System.out.flush();
    FileOutputStream fos=null;
    if (args.length < 2)
    String localFile=null;
    // Get only file name
    StringTokenizer st=new StringTokenizer(url.getFile(), "/");
    while (st.hasMoreTokens())
    localFile=st.nextToken();
    fos = new FileOutputStream(localFile);
    else
    fos = new FileOutputStream(args[1]);
    int oneChar, count=0;
    while ((oneChar=is.read()) != -1)
    fos.write(oneChar);
    count++;
    is.close();
    fos.close();
    System.out.println(count + " byte(s) copied");
    catch (MalformedURLException e)
    { System.err.println(e.toString()); }
    catch (IOException e)
    { System.err.println(e.toString()); }
    ok

  • Set XML file using URL Param

    Hi Guys,
    well I got talked into writing a quick html application using Spry as I had once done this before.
    However, this time I'm using multiple XML files as a datasource and can't seem to get the code right. It's probably really easy for all you guru's out there, but I'm more a designer than programmer so I was hoping someone could have a quick look:
    Im using Spry.Utils.getLocationParamsAsObject and used the following code to identify the right node in the XML file to show you the record as declared in the URL:
    var xpath = "Cocktails/cocktail";
    if ((params.id))
      xpath = "Cocktails/cocktail[@id = '"+params.id+"']";
    However, this was done using one large XML file with all the records.
    This time I have one XML file per record and need to identify the correct file. The file is named using the following convention 'cocktail%ID_HERE%.xml' so this time I need to to get the ID value from the URL and use it to lookup the right XML file. I wrote the following code having 'reverse engineered' this from my last project, but obviously it doesn't work:
    var rsCocktail = new Spry.Data.XMLDataSet("xml/cocktail.xml", "Cocktail");
    If ((params.id))
              rsCocktail = new Spry.Data.XMLDataSet("xml/cocktail"+params.id+".xml", "Cocktail");
    I'm assumig the idea is correct, the code is just wrong as I can't insert the variable in the filename like that. Anyone willing to shine some light on this?
    Much appreciated!!!

    This is what the head section should look like
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <link href="SpryAssets/SpryMasterDetail.css" rel="stylesheet">
    <script src="SpryAssets/xpath.js"></script>
    <script src="SpryAssets/SpryData.js"></script>
    <script src="SpryAssets/SpryURLUtils.js"></script>
    <script>
    var params = Spry.Utils.getLocationParamsAsObject();
    var rsCocktail = new Spry.Data.XMLDataSet(params.id ? "xml/cocktail"+params.id+".xml" : "xml/cocktail.xml", "Cocktail");
    </script>
    </head>
    <body>
    </body>
    </html>

  • Writing to a flat file using UTL in a procedure

    Hello All,
    I am creating a procedure in which I am trying to write data to a flat file using UTL. Code is shown below:
    CREATE OR REPLACE PROCEDURE wrt_lifungduty IS
       sql_stmt             varchar2(200);
       sql_stmt1            varchar2(200);
       sql_stmt2            varchar2(200);
       v_cur_hdl            integer;
       v_rows_processed     BINARY_INTEGER;
       V_file           UTL_FILE.FILE_TYPE;
       V_flatfile_line      VARCHAR2(98) := NULL;
      V_OBLIGATION_KEY    NUMBER(10);
      V_OBLIGATION_LEVEL  VARCHAR2(6);
      V_KEY_VALUE_1       VARCHAR2(20);
      V_KEY_VALUE_2       VARCHAR2(20);
      V_PARTNER_TYPE      VARCHAR2(6);
      V_PARTNER_ID        VARCHAR2(10);
      V_EXT_INVC_NO       VARCHAR2(30);
      V_EXT_INVC_DATE     DATE;
      V_PAID_DATE         DATE;
      V_PAID_AMT          NUMBER(20,4);
      V_COMP_ID           VARCHAR2(10);
      V_RECEIPT_DATE      DATE;
      V_ORDER_QTY         NUMBER(12,4);
      V_RECEIPT_QTY       NUMBER(12,4);
      V_FRT               NUMBER;
      V_DUTY              NUMBER;
      V_SUPPLIER          NUMBER;
      V_FLAG              VARCHAR2(1);
      V_ELC_COST          NUMBER;
      V_ADJ_ELC           NUMBER;
    Cursor x is
          select OBLIGATION_KEY,OBLIGATION_LEVEL,KEY_VALUE_1,KEY_VALUE_2,PARTNER_TYPE,PARTNER_ID,EXT_INVC_NO,EXT_INVC_DATE
                 ,PAID_DATE,PAID_AMT,COMP_ID,RECEIPT_DATE,ORDER_QTY,RECEIPT_QTY,FRT,DUTY,SUPPLIER,FLAG,ELC_COST,ADJ_ELC
          from RMSBIZ.CT_ANALYZE_LIFUNG_DUTY;    
    BEGIN
    if not UTL_FILE.IS_OPEN(V_file) then
          V_file := UTL_FILE.FOPEN('/exchange/biz/rms2lan','sb_duty.dat','w'); --need to give the location for testing
       end if;
    for x1 in x loop
      V_OBLIGATION_KEY    :=1;
      V_OBLIGATION_LEVEL  :='test';
      V_OBLIGATION_KEY    :=x1.OBLIGATION_KEY;
      V_OBLIGATION_LEVEL  :=x1.OBLIGATION_LEVEL;
      V_KEY_VALUE_1       :=x1.KEY_VALUE_1;
      V_KEY_VALUE_2       :=x1.KEY_VALUE_2;
      V_PARTNER_TYPE      :=x1.PARTNER_TYPE;
      V_PARTNER_ID        :=x1.PARTNER_ID;
      V_EXT_INVC_NO       :=x1.EXT_INVC_NO;
      V_EXT_INVC_DATE     :=x1.EXT_INVC_DATE;
      V_PAID_DATE         :=x1.PAID_DATE;
      V_PAID_AMT          :=x1.PAID_AMT;
      V_COMP_ID           :=x1.COMP_ID;
      V_RECEIPT_DATE      :=x1.RECEIPT_DATE;
      V_ORDER_QTY         :=x1.ORDER_QTY;
      V_RECEIPT_QTY       :=x1.RECEIPT_QTY;
      V_FRT               :=x1.FRT;
      V_DUTY              :=x1.DUTY;
      V_SUPPLIER          :=x1.SUPPLIER;
      V_FLAG              :=x1.FLAG;
      V_ELC_COST          :=x1.ELC_COST;
      V_ADJ_ELC           :=x1.ADJ_ELC;
      V_flatfile_line:=  V_OBLIGATION_KEY||','||
      V_OBLIGATION_LEVEL  ||','||
      V_KEY_VALUE_1       ||','||
      V_KEY_VALUE_2       ||','||
      V_PARTNER_TYPE      ||','||
      V_PARTNER_ID        ||','||
      V_EXT_INVC_NO       ||','||
      V_EXT_INVC_DATE     ||','||
      V_PAID_DATE         ||','||
      V_PAID_AMT          ||','||
      V_COMP_ID           ||','||
      V_RECEIPT_DATE      ||','||
      V_ORDER_QTY         ||','||
      V_RECEIPT_QTY       ||','||
      V_FRT               ||','||
      V_DUTY              ||','||
      V_SUPPLIER          ||','||
      V_FLAG              ||','||
      V_ELC_COST          ||','||
      V_ADJ_ELC;
    V_flatfile_line:= V_OBLIGATION_KEY||','|| V_OBLIGATION_LEVEL;
        UTL_FILE.PUT_LINE(V_file, V_flatfile_line);
    end loop
      commit;
       UTL_FILE.fclose(V_file); 
    END;
                Getting the following errors:
    SQL>Welcome-->
    ERROR at line 1:
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "SYS.UTL_FILE", line 98
    ORA-06512: at "SYS.UTL_FILE", line 157
    ORA-06512: at "RMSBIZ.WRT_LIFUNGDUTY", line 39
    ORA-06512: at line 1
    SQL>Welcome-->39
    39* V_file := UTL_FILE.FOPEN('/exchange/biz/rms2lan','sb_duty.dat','w');
    SQL>Welcome-->
    Does any one know why it is erroring out?
    Thanks,
    Chiru

    the code below works if i take out the last 3 columns while writing to the flat file line.
    CREATE OR REPLACE PROCEDURE wrt_lifungduty IS
       sql_stmt             varchar2(200);
       sql_stmt1            varchar2(200);
       sql_stmt2            varchar2(200);
       v_cur_hdl            integer;
       v_rows_processed     BINARY_INTEGER;
       V_file           UTL_FILE.FILE_TYPE;
       V_flatfile_line      VARCHAR2(98) := NULL;
      V_OBLIGATION_KEY    NUMBER(10);
      V_OBLIGATION_LEVEL  VARCHAR2(6);
      V_KEY_VALUE_1       VARCHAR2(20);
      V_KEY_VALUE_2       VARCHAR2(20);
      V_PARTNER_TYPE      VARCHAR2(6);
      V_PARTNER_ID        VARCHAR2(10);
      V_EXT_INVC_NO       VARCHAR2(30);
      V_EXT_INVC_DATE     DATE;
      V_PAID_DATE         DATE;
      V_PAID_AMT          NUMBER(20,4);
      V_COMP_ID           VARCHAR2(10);
      V_RECEIPT_DATE      DATE;
      V_ORDER_QTY         NUMBER(12,4);
      V_RECEIPT_QTY       NUMBER(12,4);
      V_FRT               NUMBER;
      V_DUTY              NUMBER;
      V_SUPPLIER          NUMBER;
      V_FLAG              VARCHAR2(1);
      V_ELC_COST          VARCHAR2(20);
      V_ADJ_ELC           VARCHAR2(20);
    Cursor x is
          select OBLIGATION_KEY,OBLIGATION_LEVEL,KEY_VALUE_1,KEY_VALUE_2,PARTNER_TYPE,PARTNER_ID,EXT_INVC_NO,EXT_INVC_DATE
                 ,PAID_DATE,PAID_AMT,COMP_ID,RECEIPT_DATE,ORDER_QTY,RECEIPT_QTY,FRT,DUTY,SUPPLIER,FLAG,ELC_COST,ADJ_ELC
          from RMSBIZ.CT_ANALYZE_LIFUNG_DUTY;
    BEGIN
    if not UTL_FILE.IS_OPEN(V_file) then
          V_file := UTL_FILE.FOPEN('/rmsapps/rms803/biz/data/utl_files','sb_duty.csv','w'); --need to give the location for testing
       end if;
    for x1 in x loop
      V_OBLIGATION_KEY    :=nvl(x1.OBLIGATION_KEY,null);
      V_OBLIGATION_LEVEL  :=nvl(x1.OBLIGATION_LEVEL,null);
      V_KEY_VALUE_1       :=x1.KEY_VALUE_1;
      V_KEY_VALUE_2       :=x1.KEY_VALUE_2;
      V_PARTNER_TYPE      :=x1.PARTNER_TYPE;
      V_PARTNER_ID        :=x1.PARTNER_ID;
      V_EXT_INVC_NO       :=x1.EXT_INVC_NO;
      V_EXT_INVC_DATE     :=x1.EXT_INVC_DATE;
      V_PAID_DATE         :=x1.PAID_DATE;
      V_PAID_AMT          :=x1.PAID_AMT;
      V_COMP_ID           :=x1.COMP_ID;
      V_RECEIPT_DATE      :=x1.RECEIPT_DATE;
      V_ORDER_QTY         :=x1.ORDER_QTY;
      V_RECEIPT_QTY       :=x1.RECEIPT_QTY;
      V_FRT               :=x1.FRT;
      V_DUTY              :=x1.DUTY;
      V_SUPPLIER          :=x1.SUPPLIER;
      V_FLAG              :=nvl(x1.FLAG,'0');
      V_ELC_COST          :=to_char(nvl(x1.ELC_COST,0));
      V_ADJ_ELC           :=to_char(nvl(x1.ADJ_ELC,0));
      V_flatfile_line:=  V_OBLIGATION_KEY||','||
      V_OBLIGATION_LEVEL  ||','||
      V_KEY_VALUE_1       ||','||
      V_KEY_VALUE_2       ||','||
      V_PARTNER_TYPE      ||','||
      V_PARTNER_ID        ||','||
      V_EXT_INVC_NO       ||','||
      V_EXT_INVC_DATE     ||','||
      V_PAID_DATE         ||','||
      V_PAID_AMT          ||','||
      V_COMP_ID           ||','||
      V_RECEIPT_DATE      ||','||
      V_ORDER_QTY         ||','||
      V_RECEIPT_QTY       ||','||
      V_FRT               ||','||
      V_DUTY              ||','||
      V_SUPPLIER          ||','||
    -- V_FLAG            ||','||
      V_ELC_COST          ||','||
      V_ADJ_ELC;
        UTL_FILE.PUT_LINE(V_file, V_flatfile_line);
    end loop
      commit;
       UTL_FILE.fclose(V_file);
    EXCEPTION
      WHEN UTL_FILE.INVALID_PATH
      THEN
          DBMS_OUTPUT.PUT_LINE ('error: INVALID_PATH');
      WHEN UTL_FILE.INVALID_MODE
      THEN
          DBMS_OUTPUT.PUT_LINE ('error: INVALID_MODE');
      WHEN UTL_FILE.INVALID_FILEHANDLE
      THEN
          DBMS_OUTPUT.PUT_LINE ('error: INVALID_FILEHANDLE');
      WHEN UTL_FILE.INVALID_OPERATION
      THEN
          DBMS_OUTPUT.PUT_LINE ('error: INVALID_OPERATION');
      WHEN UTL_FILE.READ_ERROR
      THEN
          DBMS_OUTPUT.PUT_LINE ('error: READ_ERROR');
      WHEN UTL_FILE.WRITE_ERROR
      THEN
          DBMS_OUTPUT.PUT_LINE ('error: WRITE_ERROR');
      WHEN UTL_FILE.INTERNAL_ERROR
      THEN
          DBMS_OUTPUT.PUT_LINE ('error: INTERNAL_ERROR');
      WHEN OTHERS THEN
         --     v_error_code := SQLCODE;
    --          v_error_message := SQLERRM;
    --         dbms_output.put_line('ERROR: '||v_error_code);
       --       dbms_output.put_line('ERROR: '||v_error_message);
              RAISE_APPLICATION_ERROR(-20003,'sbduty - aborted');  
    END;
    /It fails as soon as it encounters the V_FLAG in the V_flat_file_line. The data in the table has nulls for the FLAG, and some -ve numbers for the ELC_COST,ADJ_ELC..but that should'nt cause any problems does it?
    Whats wrong with those 3 columns?
    Errors that i get are:
    SQL>Welcome-->BEGIN wrt_lifungduty; END;
    ERROR at line 1:
    ORA-20003: sbduty - aborted
    ORA-06512: at "RMSBIZ.WRT_LIFUNGDUTY", line 117
    ORA-06512: at line 1
    SQL>Welcome-->117
    117* RAISE_APPLICATION_ERROR(-20003,'sbduty - aborted');
    SQL>Welcome-->
    Thanks,
    Chiru

  • How do I scan multiple pages into one pdf file using the PIXMA MG7520 on Windows 8.0? Please help!

    I recently received a PIXMA MG7520 for a gift.  It works great with my lenovo laptop/tablet running on Windos 8.0.  The one drawback to the HP all-in-one that it replaced is it does not have an ADF.  That being said, there must be some way to scan multiple pages into one pdf file.  I need help figuring thing out.  Thanks in advance!
    Solved!
    Go to Solution.

    Hi mdtolbert54,
    There is a program that comes with the printer called the IJ Scan Utility that can assist you with scanning multiple pages into a single PDF document.  To do this, please follow these steps:
    1. On your keyboard, press the Windows key.
    2. Start typing IJ SCAN UTILITY. The search window opens as you type. Once the IJ SCAN UTILITY is displayed, please select and open it.
    3. In the Canon IJ Scan Utility window that opens, click SETTINGS.... in the bottom right of the window. The Settings dialog box appears.
    4. Click the DOCUMENT SCAN option on the left pane of the window.
    5. In the SAVE SETTINGS section of the window, you will select the save format and location of the document you are about to scan.
    a.) In the FILE NAME field, specify the name you would like to give the file. By default the filename will begin with IMG; you can remove IMG and change it to whatever you would like to name the file.
    b.) In the DATA FORMAT field, use the drop-down arrow to select the PDF (Multiple Pages) option. 
    c.) In the SAVE IN field, please navigate to the area where you would like the file to be saved once it is scanned in. By default, the file will be saved in the MY DOCUMENTS folder.
    6. Once all settings have been selected, click the OK button at the bottom of the window to save the changes. The IJ Scan Utility main screen appears.
    7. Click the DOCUMENT button. Scanning starts. Click the CANCEL button to cancel scanning if needed. Scanned items are saved in previously selected folder location specified in the SETTINGS... window.
    If you find that you need advanced scanning options such as adjusting resolution, brightness, contrast, saturation, color balance, etc. in addition to the options selected above, please click on the SCANGEAR button on the IJ Scan Utility Main screen, then adjust the items as necessary.
    Once the items above are set for document scanning, in the future, you will only need to launch the IJ Scan Utility, then press the DOCUMENT button to perform the scan (unless you want to make changes to the settings).
    Hope this helps!
    This didn't answer your question or issue? Please call or email us using one of the methods on the Contact Us page for further assistance.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • Split records into Multiple csv files using a Threshold percentage

    Hi Gurus,
    I have a requirement to split the data into two csv file from a table using a threshold value(in Percentage) .
    Assume that If my source select query of interface fetches 2000 records , I will provide a threshold value like 20%.
    I need to generate a csv1 with 400 records(20% of 2000) and the rest of the records into another csv2.
    For implementing this I am trying to use the following process.
    1) Create a procedure with the select query to get the count of records.
    Total Records count: select count(1) from source_table <Joins> <Lookups> <Conditions>;
    2) Calculate the Record count to first CSV using the threshold_value.
    CSV1_Count=Total records count /threshold_value
    3) Create a view that fetches the CSV1_Count(400) records for CSV1 as follows.
    Create view CSV1_view as select Col1,Col2,Col3 from source_table <Joins> <Lookups> <Conditions>
    Where rownum<=CSV1_Count;
    4) Generate CSV1 file using View 'CSV1_View'
    5) Generate CSV2 File using the Interface with same select statement (with columns ) to generate a CSV.
    select Col1,Col2,Col3 from source_table ST <Joins> <Lookups> <Conditions>
    Left outer join (Select Col1 from CSV1_View ) CS on CS.Col1=ST.Col1 where CS.Col1 is null;
    Which gives the Total records minus the CS1_View records.
    The above process seems a bit complex and very simple . If any changes in my Interface I also need to change the procedure (counts the no:of records).
    Please provide your comments and feedback about this and looking for your inputs for any new simple approach or fine tune the above approach.
    Thanks,
    Arjun

    Arjun,
    This are my thoughts and Lets do it in 3 Steps
    Step 1.  ODI Procedure
    Drop table Temp_20 ;
    Create table Temp_20 as select * from table where rownum < ( SELECT TRUNC( COUNT(1) /5) FROM TABLE ) .
    [ ** This way iam fetching approx 20% of the table data and loading into Temp table . 1/5 th is 20%  so i am dividing count by 5
    I don't believe View will help you especially with RowNum as if you run the same query with rownum < N the rows order might differ . so Temp table is great ]
    Step 2 .  Use OdiSqlUnload  with select columns  from temp_20
    Step 3 . Use again OdiSqlUnload  with  select columns from table where  ( uk keys ) not in ( selecy uk_keys from temp_20)
    [** this way you can pick the remaining 80% ** and the data will be not repeat itself across 20% and 80% , as might happen with view ]
    what do you think ?

  • Writing into a pdf file in japanese

    We have to write to a PDF file using java. For this purpose, we are using a free package downloaded from the internet. We are now able to write to PDF using this package. We also have to write Japanese text to PDF. This package is not supporting that. I feel, we need to set a few things like encoding type, base font, Mapping files etc. Please direct me to any source where i can get help.

    I am able to display the Japanese charatcers in the PDF file when using Japanese Regional Settings on Windows OS. But this Japanese text appears only when the Text is selected on the PDF file.
    When Changed to English Regional Settings, the Japanese text is not written correctly in the PDF file.
    I am using iText along with itextAsian.jar. JDK version is 1.4.2
    Does anyone have a clue how to write into the PDF using Japanese in English Locale?

Maybe you are looking for

  • Error Reading DNS Settings

    Hey folks, I'm having some odd problems with DNS. Over the weekend I added a second ML server to my network. I changed the hostname on my original server from my FQDN to server1.domain.com. When I changed the hostname, the server created a new zone w

  • I have lost the automatic date/time stamp

    I have lost the automatic date/time stamp when a form is submitted on my response page.  How do I make it start doing it again?  The column just appears blank now with new submissions.

  • Loadjava ...a web proxy generated by JDeveloper

    I'll try to be brief... two db servers communicate throgh a web service.Based on that Web Service( ws-for short) I'm doing a web proxy,witch I am loading into a database...and then I can do calls to it through pl/sql(create function ...as laguage jav

  • Does Bug Base Work? In regards to AIR

    As the title says, does bug base work? I have been following the Bug Base daily checking constantly for updates from Adobe staff in regards to many currently present bugs that IMO left unfixed make this platform more unreliable as time goes on. It se

  • Syncing books to Ipad.

    Have books on home page of Kindle app. These were emailed to me. How do I sync them to my Ipad?