Redirection with exec

Hai friends,
i want to execute a shell command in java.. so i executed the below program..
i am getting the output when i gave ls but it is not working when i am giving ls >abc.txt
this is the program:
import java.util.*;
import java.io.*;
// class StreamGobbler omitted for brevity
class StreamGobbler extends Thread
InputStream is;
String type;
OutputStream os;
StreamGobbler(InputStream is, String type)
this(is, type, null);
StreamGobbler(InputStream is, String type, OutputStream redirect)
this.is = is;
this.type = type;
this.os = redirect;
public void run()
try
PrintWriter pw = null;
if (os != null)
pw = new PrintWriter(os);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null)
if (pw != null)
pw.println(line);
System.out.println(type + line);
if (pw != null)
pw.flush();
} catch (IOException ioe)
ioe.printStackTrace();
public class TestExec
public static void main(String args[])
try
String cmd ="ls -l " ;
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd);
// any error message?
StreamGobbler errorGobbler = new
StreamGobbler(proc.getErrorStream(), "ERR");
// any output?
StreamGobbler outputGobbler = new
StreamGobbler(proc.getInputStream(), "");
// kick them off
errorGobbler.start();
outputGobbler.start();
// any error???
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
} catch (Throwable t)
t.printStackTrace();
Now,i want to redirect the output i get from ls command to some file...
is it possible??
Help me please.

ps.sorry for the double reply; something got stuck I guess.Brain?Nah, that silly forum software complained about "please enter subject title"
where there definitely was one (I didn't touch it) then I pressed back
and fiddled a bit, and voila: a double reply was the result ;-)
kind regards,
Jos (my last brain activity was somewhere in the 1970s and it hurt,
so I switched it off ;-)

Similar Messages

  • Stored Procedure, "WITH EXEC AS CALLER"

    I'm reviewing a stored procedure some one else wrote.
    Right before the variable declarations (DECLARE) and right after the parameters they wrote the following:
    WITH EXEC AS CALLER
    AS
    What does this do, exactly? I've looked at stored procedure tutorials and examples and none of them use this.
    Here is more of the code snippet if need be.
    USE [Database1]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[RagGetIt]
    @initials nvarchar(3), @state nvarchar(2)
    WITH EXEC AS CALLER
    AS
    DECLARE
    @var1 INT,
    @var2 INT,
    @var3 INT,
    Also, is there a point of having those three 'GO' statements in the beginning, or is GO just supposed to go at the end of the procedure's code?
    -Nothing to see. Move along.

    http://lmgtfy.com/?q=with+exec+as+caller+mssql
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

  • Create data base table with EXEC SQL

    Hello,
    I nead to create o data base table with EXEC SQL in an Abap program.
    My code is :
    TRY.
       EXEC SQL.
          CREATE table zt_hello ( mandt char(4) NOT NULL,
                                  kunnr char(10) NOT NULL,
                                  PRIMARY KEY (mandt, kunnr) )
        ENDEXEC.
      CATCH cx_sy_native_sql_error INTO exc_ref.
        error_text = exc_ref->get_text( ).
    ENDTRY.
    IF sy-subrc = 0.
      COMMIT WORK.
    ENDIF.
    But it still not working.
    Can you help me please.
    Thanks.
    Edited by: widad soubhi on Jul 14, 2010 5:26 PM

    Please refer this code
    REPORT z_struct_create .
    DATA: my_row(500) TYPE c,
    my_file_1 LIKE my_row OCCURS 0 WITH HEADER LINE.
    DATA: dd02v TYPE dd02v.
    DATA: my_file_tab1 LIKE dd03p OCCURS 0 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text
    NO INTERVALS.
    PARAMETERS:
    name TYPE ddobjname,
    testo TYPE text40,
    file_1 LIKE rlgrap-filename.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK blk.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_1.
    PERFORM file_selection USING file_1.
    INITIALIZATION.
    text = text-001.
    START-OF-SELECTION.
    IF file_1 IS INITIAL.
    MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 001.
    EXIT.
    ENDIF.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = file_1
    filetype = 'ASC'
    TABLES
    data_tab = my_file_1.
    IF sy-subrc 0.
    MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 002.
    EXIT.
    ENDIF.
    LOOP AT my_file_1.
    IF sy-tabix > 1.
    CLEAR my_file_tab1.
    SPLIT my_file_1 AT ';' INTO
    my_file_tab1-fieldname
    my_file_tab1-datatype
    my_file_tab1-leng
    my_file_tab1-decimals
    my_file_tab1-ddtext
    my_file_tab1-inttype = 'C'.
    my_file_tab1-INTLEN = my_file_tab1-leng.
    my_file_tab1-tabname = name.
    my_file_tab1-position = sy-tabix - 1.
    my_file_tab1-ddlanguage = sy-langu.
    my_file_tab1-OUTPUTLEN = my_file_tab1-leng.
    APPEND my_file_tab1.
    ENDIF.
    ENDLOOP.
    dd02v-tabname = name.
    dd02v-ddlanguage = sy-langu.
    dd02v-tabclass = 'INTTAB'.
    dd02v-DDTEXT = testo.
    dd02v-MASTERLANG = sy-langu.
    IF NOT my_file_tab1[] IS INITIAL.
    CALL FUNCTION 'DDIF_TABL_PUT'
    EXPORTING
    name = name
    dd02v_wa = dd02v
    TABLES
    dd03p_tab = my_file_tab1
    EXCEPTIONS
    tabl_not_found = 1
    name_inconsistent = 2
    tabl_inconsistent = 3
    put_failure = 4
    put_refused = 5
    OTHERS = 6
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ELSE.
    MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 003.
    EXIT.
    ENDIF.
    *& Form file_selection
    -->P_FILE_1 text
    FORM file_selection USING p_file.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    def_filename = ''
    def_path = 'c:\'
    mask = ',.,..'
    mode = '0'
    title = 'Selezione file'
    IMPORTING
    filename = p_file
    RC = RCODE
    EXCEPTIONS
    inv_winsys = 1
    no_batch = 2
    selection_cancel = 3
    selection_error = 4
    OTHERS = 5.
    ENDFORM. " file_selection
    File Template:
    Fieldname;Data Type;Lentgh;Dec.;Descr.
    FIELD1;CHAR;000020;000000;my field 1
    FIELD2;CHAR;000008;000000;my field 2
    FIELD3;CHAR;000007;000000;my field 3
    FIELD4;CHAR;000006;000000;my field 4

  • Remote Desktop Session Host USB Redirection with Windows 8.1

    Hello all,
    I've currently setup this environment (both OS/Client are fully up to date as of today). I am using one server as the Gateway, Web Access, Connection Broker and RD Session Host with one collection.
    I am trying to get USB redirection setup to work properly. Some devices work (pen drives/iPhone etc), but other devices (we have a smart card reader we are testing that works natively on my Windows 8 machine) that doesn't appear.
    I see conflicting information wherever I go on the internet on how to get this working. Some places suggest modifying the registry on the client machine, other places suggest you need to add a customrdpproperty to the collection.
    What is the proper way to get this working on 2012 R2 with Windows 8.1?

    Hi Gavin,
    Thank you for posting in Windows Server Forum.
    For redirecting USB on server 2012 R2 is to set the custom property for a session collection by using following command.
    Set-RDVirtualDesktopCollectionConfiguration –CollectionName YourCollectionName –CustomRdpProperty "usbdevicestoredirect:s:{6bdd1fc6-810f-11d0-bec7-08002be2092f }"
    where {6bdd1fc6-810f-11d0-bec7-08002be2092f} is the System-Defined Device Setup Class GUID. 
    More information.
    RemoteFX USB Redirection in Windows Server 2012 and Windows 8
    Apart from above also refer below links for information.
    1. Smart Card and Remote Desktop Services
    2. Why can't I see my local smartcard readers when I connect via RDP?
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    TechNet Community Support

  • Use Of "#EC CI_EXECSQL in ABAP with EXEC SQL. Statement giving Syntax Error

    Dear Gurus,
    I have encountered an issue while trying to remove warning for using Native SQL statement using pseudo comment "#EC CI_EXECSQL
    The thing is like this -- i have used follwing native sql command in abap.
    EXEC SQL.
        CONNECT TO 'SURROUND_DB'
      ENDEXEC.
    Now when i am checking this code in code inspector it is showing a warning with information below
    CA CL_CI_TEST_CRITICAL_STATEMENTS0006
    Code Inspector
    Critical Statements
    Use of Native SQL
    Authorization checks cannot be appropriately run using EXEC SQL and should be carried out at program level.
    The message can be hidden using the pseudo-comment "#EC CI_EXECSQL
    Use of exceptin handling section for that warning showing me to use :
    The message can be hidden using pseudo
    comment      "#EC CI_EXECSQL
    Now when I am using "#EC CI_EXECSQL in the abap like below :
    EXEC SQL. "#EC CI_EXECSQL
        CONNECT TO 'SURROUND_DB'
      ENDEXEC.
    It is giving syntax error
    The text literal ""#EC CI_EXECSQL        " is longer than 255
    characters.Check whether it ends correctly.
    Please provide the guideline to resolve this issue.
    Thanks & regards
    Saifur Rahaman.

    Hi Saifur,
    You can remove the warning using the following syntax:
    EXEC "#EC CI_EXECSQL
      SQL.
        CONNECT TO 'SURROUND_DB'
      ENDEXEC.
    At least, it worked fine for me when using OPEN CURSOR, SELECT, FETCH and so on statements.
    The way to use the pseudo comment is not very intuitive, but at least for my examples worked fine.
    I hope this may help you.
    Best regards,
    Edgardo G. König

  • Why do I always get redirected with customer support?

    So today I went on the phone with Verizon just to figure out why my internet speed has been slow because I finally got the time too. I used to get around a 2.5 - 3 Mbps speed connection and now I only get a 1.5 Mbps or so connection. This originally happened after a Verizon tech agent came to our house and said that our speed was "too high and it shouldn't be that high" when my internet connection dropped. So he went over to the cable lines down the street and lowered my connection and then comes back and says its fixed. Now he didn't fix anything or do anything for that matter. I had to login MYSELF into my Verizon account on my modem which brought the internet up again. So basically, I paid for the Verizon agent to come and lower my speed and gained nothing from it. However, I still pay the same price as before for the 3 Mbps connection...
    Now I went through the customer support on the phone to talk about this and they redirected me again and again and again probably at the very least 6 or more times. Everytime I got to a technical support, they would redirect me to a billing support and so forth. I told my problem over and over to no avail. All I want is my 2.5 - 3 Mbps speed again which I used to have... I STILL pay for the 3 Mbps connection when I only get around 1.5 Mbps now.
    I feel like this is it... I can't handle this anymore, everytime I go to Verizon customer support I get redirected at least 5+ times for over 2-3 hours just to get one problem fixed. Half the time these morons don't even know what they're doing and just redirect me over and over again.
    I'm thinking of simply changing to another ISP.

    Before you change ISP I would demand a refund for the period of time your speed was subpar. It is true that for a number of different reasons your line may no be able to give reliable higher speeds. If you want to save some $$ look into the 3/1 FIOS plan, that is what I have. It is not an obvious choice on the VZ web site but the price is very fair IMO
    Hopefully by posting here one of the verizon reps will "hook you up" no pun intended.
    If a forum member gives an answer you like, please give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem. Thanks !!!
    http://forums.verizon.com/t5/Verizon-net-Email/Fix-for-Missing-Inbox-sent-folders-etc-with-Internet-Explorer-11/m-p/647399

  • JSF - redirect with parameter

    Hi All,
    I have a JSF application that is consists of 5 pages. The first one is clear JSP page where the user have the possibility to logged in the application. After the user has been successfully authorized the JSF page redirects to JSF page that displays list of items.So far so good, but when the list of items contains only one item I want to redirect directly to the third page that displays the description of the selected item from the second page. The second page pass the item id with the following code:
         <h:commandLink action="ItemDescription" actionListener="#{itemDesc.processAction}">
              <f:param name="item_id" value="#{MyItem.id}"></f:param>
              <h:outputText value="#{MyItem.name}"></h:outputText>
         </h:commandLink> Currently I can redirect to the third page by using FacesContext.getCurrentInstance().getExternalContext().redirect("Third.faces") but I don't know how to set the parameter item_id.
    Do you have any suggestions?

    Pass it along as a query parameter:redirect("Third.faces?item_id=" + id);

  • Guest web redirect with redundant ISE

      Dears,
    I have redundant ISE configured (primary and secondary) and integrated cisco WLC 5508.
    I already configured SSID for Guest Web authentication.
    With primary ISE the redirect link is working fine but when I power off the primary ISE the redirect link stop working even if I changed the Role of the secondary to primary.
    Please I need your support,
    Regards,                

    Thank you for your reply,
    - Yes on the same nodegroup.
    - Yes resolved correctly in the DNS.
    - I will recheck it but I already create an ACL for redirect.
    - Yes the both ISE defined on the Radius Auth. on the WLC.
    Now I will check the ACL and back to you.
    Regards,

  • HTTP Redirect with Global Load Balancing

    I've seen a lot of documentation about redirects and what I am trying to do seems simple enough yet I can't get it to work. Here is a summary:
    We have two CSSs in different data centers with load balancing in a roundrobin fashion.
    User types www.test.com:9086/test.html
    User hits one of the CSSes configured to respond to www.test.com, CSS1 and CSS2.
    If CSS1 gets the request, it should redirect request to server1:9086/test.html
    If CSS2 gets the request, it should redirect request to server2:9086/test.html
    Here is a sample of one of the CSSes:
    content vTEST
    dnsbalance roundrobin
    add dns www.test.com
    url "/*"
    protocol tcp
    port 9086
    vip address 192.168.3.135
    add service rTEST
    active
    service rTEST
    protocol tcp
    port 9086
    type redirect
    keepalive type none
    ip address 2.2.2.2
    redirect-string "server1:9086/test.html"
    active
    I've seen a lot of example of using HTTP Redirects, but none of them touch on using global load balancing as we are trying to accomplish.
    Now, if I type in a browser:
    http://www.test.com:9086/test.html
    it fails. Why? because the CSS returns back an IP of 2.2.2.2 for www.test.com, which isn't a real IP address (this is by design). If I type:
    http://192.168.3.135:9086/test.html
    it works because it successfully redirects to:
    http://server1:9086/test.html
    because it is going directly against the VIP and redirecting as it should.
    So the redirect function we know is working on the CSS as expected. However, the problem is this:
    When I ping www.test.com I should get back the VIP address of the content rule (192.168.3.135) and I do UNTIL I ADD THE REDIRECT TYPE to the service. Once I do that if I ping www.test.com I will get back 2.2.2.2. Somehow once the redirect is added the IP address of the service (2.2.2.2) is returned instead of the content VIP (192.168.3.135). That shouldn't happen.
    I hope this makes sense and any help would be greatly appreciated!!!

    I think what you want to do is explained at :
    http://www.cisco.com/en/US/products/hw/contnetw/ps789/products_configuration_example09186a0080094068.shtml
    For your information, you should also look at this solution :
    http://www.cisco.com/en/US/products/hw/contnetw/ps789/products_configuration_example09186a00801dcd75.shtml
    Regards,
    Gilles.

  • Guest portal redirection with mulple PSNs

    Hi All
    In a distributed deployment where there is more than one PSN's how do we have a common url for guest redirection when doing a CWA (assuming no load balancer is used for the PSNs)? usually the redirection url would be 'https://<ise01.fqdn/guetsportal" or 'https://<ise02.fqdn/guetsportal" and we can only specify one in the wlc guest ssid?
    Thanks

    Fully Qualified Domain Name in URL Redirection
    When Cisco ISE builds an authorization profile redirect (for central web authentication, device registration web authentication, native supplicant provisioning, mobile device management, and client provisioning and posture services), the resulting cisco-av-pair includes a string similar to the following:
    url-redirect=https://ip:port/guestportal/gateway?sessionId=SessionIdValue&action=cwa
    When processing this request, Cisco ISE substitutes actual values for some keywords in this string. For example, SessionIdValue is replaced with the actual session ID of the request. For eth0 interface, Cisco ISE replaces the IP in the URL with the FQDN of the Cisco ISE node. For non-eth0 interfaces, Cisco ISE uses the IP address in the URL. You can assign a host alias(name) for interfaces eth1 through eth3, which Cisco ISE can then substitute in place of IP address during URL redirection. To do this, you can use the ip host command in the configuration mode from the Cisco ISE CLI:
    ISE /admin(config)# ip host IP_address host-alias FQDN-string
    where IP_address is the IP address of the network interface (eth1 or eth2 or eth3)
    host-alias is the name that you assign to the network interface
    FQDN-string is the fully qualified domain name of the network interface
    Using this command, you can assign a host-alias or an FQDN-string or both to a network interface.
    Here is an example:
    ISE/admin(config)# ip host a.b.c.d sales sales.amer.xyz.com
    After you assign a host alias to the non-eth0 interface, you must restart the application services on Cisco ISE using the application start ise command.
    Use the no form of this command to remove the association of the host alias with the network interface:
    ISE/admin(config)# no ip-host IP_address host-alias FQDN-string
    Use the show running-config command to view the host alias definitions.
    If you provide the FQDN-string, Cisco ISE replaces the IP address in the URL with the FQDN. If you provide only the host alias, Cisco ISE combines the host alias with the configured IP domain name to form a complete FQDN, and replaces the IP address in the URL with the FQDN. If you do not map a network interface to a host alias, then Cisco ISE uses the IP address of the network interface in the URL.
    When you make use of non-eth0 interfaces for client provisioning or native supplicant or guest flows, you have to make sure that the IP address or host alias for non-eth0 interfaces should be configured appropriately in the Policy Service node certificate's SAN fields.

  • Group membership redirect with AD LDS

    I have my LDS instance synchronized with my AD environment. I am only synchronizing objectClass=user. I am creating userProxyFull objects on the LDS side. Authentication is working as I have tested authenticating with an AD user to LDS.
    My application person would like to query group membership, that is the group membership that exists in AD. Is it possible to redirect group membership queries so that the group membership information from AD is provided to the application that is using
    the userProxyFull object in LDS?
    Thanks,
    Paul

    Hi,
    why do you need userProxy and AD LDS, is it that the application can only support LDAP simple bind or that you need a form of distinguishedName other than that in your AD or that the application cannot reach your DCs?
    To do Authorization, if you have ruled out having the application query AD DCs, your options are:
    [1] have the application maintain an Authorization database and sync that from your AD or provisioning system if you really need it to follow AD group membership
    [2] use adamsync to sync the groups as well as doing the userProxy transform, something like:
            <object-filter>(&#124;(objectClass=user)(objectClass=group))</object-filter>
            <attributes>
            <include>objectSID</include>
            <include>member</include>
            <exclude></exclude>
            </attributes>
    it would be best to spin up another AD LDS instance to try this against. You then need to test adding and removing users from the AD groups and check that those changes sync. This might work but unfortunately the more creative you get with object-filter
    in adamsync, the more surprising the results tend to be.
    [3] a variation on [1], ldif export your group memberships from AD and import into AD LDS (distinguishedName re-writing may be required)
    [4] have the application bind with the userProxy credentials to the rootDSE of the AD LDS instance and read tokenGroups to get a list of SIDs that you then need to resolve into groups (I mention this for completeness but it's possibly more complex application
    development than you would want to do...)
    Other options are:
    use a virtual directory tool
    use a different sync tool e.g. FIM or
     Quest One Connect
     disclaimer: I  have never used the latter.
    review the application to see if direct AD DC access is possible.
    Lee Flight

  • Performing redirects with a CSS

    Hello,
    I have a CSS performing load balancing between some servers on port 443 (SSL). Since some clients try to connect to the VIP using port 80 (hhtp), I’m trying to find a solution on the CSS to send a redirect to the client in order that this one connects to the VIP using port 443.
    Is it possible to do it on the CSS?
    Thanks in advance for your help.
    Regards.
    Alex

    Alex,
    configure a content rule with the vip address and port 80.
    config a service with type redirect, redirect-string https://www.yoursite.com and no prepend http.
    add the redirect service to the content rule and thats it!

  • TRY ... CATCH doesn't work with EXEC SQL?

    When I created a native SQL statement, I knew before, that it would take a few tries to get it working. I decided to use exception classes to avoid short dumps, but it didn't work.
    Following code causes a short dump because of the dot after :xp_stras in the native SQL SELECT statement:
       try.
           EXEC SQL                     PERFORMING  list.
             SELECT LIFNR, NAME1, STRAS
                                    INTO  :xsl
                                    FROM  LFA1
             WHERE  UPPER( NAME1 )  LIKE  :xp_name1
             AND    UPPER( STRAS )  LIKE  :xp_stras.
           ENDEXEC.
                                                                                    catch CX_SY_NATIVE_SQL_ERROR.
           write: /1 'CX_SY_NATIVE_SQL_ERROR'.
       catch CX_SY_SQL_ERROR.
           write: /1 'CX_SY_SQL_ERROR'.
       catch CX_DYNAMIC_CHECK.
           write: /1 'CX_DYNAMIC_CHECK'.
       catch CX_ROOT.
           write: /1 'CX_SY_ROOT'.
       endtry.
    In ST22 you can see
    Name of runtime error: DBIF_DSQL2_SQL_ERROR
    Exception:
    The name of the exception is empty, in other short dumps you can find there the name of the exception class. Maybe that's the reason for CATCH does'nt work, but I don't understand it.
    Online help for EXEC SQL says:
    Catchable Exceptions
    CXSY_NATIVE_SQL_ERROR_
    Cause: SQL-Error at the execution of a Native SQL-command.
    Runtime Error: DBIF_DSQL2_SQL_ERROR
    We have SAP ECC 6.0 with SAP_BASIS rel. 700 lvl. 0013.
    If You have an idea why CATCH doesn't work, please tell me!
    Regards,
    Klaus

    Hi Rob,
    I tried out Your original code as program ZTEST5 and got a short dump (sorry, some of the short dump symbols are formatting this post in a wrong way ...):
    Short text
        An SQL error occurred when executing Native SQL.
    What happened?
        The error 919 occurred in the current database connection "DEFAULT".
    What can you do?
        Note down which actions and inputs caused the error.
        To process the problem further, contact you SAP system
        administrator.
        Using Transaction ST22 for ABAP Dump Analysis, you can look
        at and manage termination messages, and you can also
        keep them for a long time.
    How to correct the error
        Database error text........: "ORA-00919: invalid function"
        Database error code........: 919
        Triggering SQL statement...: "FETCH NEXT "
        Internal call code.........: "[DBDS/NEW DSQL]"
        Please check the entries in the system log (Transaction SM21).
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "DBIF_DSQL2_SQL_ERROR" " "
        "ZTEST5" or "ZTEST5"
        "START-OF-SELECTION"
        If you cannot solve the problem yourself and want to send an error
        notification to SAP, include the following information:
        1. The description of the current problem (short dump)
           To save the description, choose "System->List->Save->Local File
        (Unconverted)".
        2. Corresponding system log
           Display the system log by calling transaction
           Restrict the time interval to 10 minutes befor
        after the short dump. Then choose "System->List->
        (Unconverted)".
        3. If the problem occurs in a problem of your own
        program: The source code of the program
           In the editor, choose "Utilities->More
        Utilities->Upload/Download->Download".
        4. Details about the conditions under which the e
        actions and input led to the error.
    System environment
        SAP-Release 700
        Application server... "lux01617"
        Network address...... "195.217.80.104"
        Operating system..... "Linux"
        Release.............. "2.6.5-7.283-smp"
        Hardware type........ "x86_64"
        Character length.... 16 Bits
        Pointer length....... 64 Bits
        Work process number.. 5
        Shortdump setting.... "full"
        Database server... "lux09208"
        Database type..... "ORACLE"
        Database name..... "D10"
        Database user ID.. "SAPDAT"
        Char.set.... "C"
        SAP kernel....... 700
        created (date)... "Dec 2 2007 20:18:08"
        create on........ "Linux GNU SLES-9 x86_64 cc3.3.3"
        Database version. "OCI_102 (10.2.0.2.0) "
        Patch level. 138
        Patch text.. " "
        Database............. "ORACLE 9.2.0.., ORACLE 10.1.0.., ORACLE 1
        SAP database version. 700
        Operating system..... "Linux 2.6"
        Memory consumption
        Roll.... 16192
        EM...... 16759392
        Heap.... 0
        Page.... 98304
        MM Used. 694160
        MM Free. 3493088
    User and Transaction
        Client.............. 500
        User................ "Z0000D2P"
        Language key........ "E"
        Transaction......... "SE38 "
        Transactions ID..... "48FE92EB921F51C3E1000000C3D95068"
        Program............. "ZTEST5"
        Screen.............. "SAPMSSY0 1000"
        Screen line......... 6
    Information on where terminated
        Termination occurred in the ABAP program "ZTEST5" - in "START-OF-SELECTION".
        The main program was "ZTEST5 ".
        In the source code you have the termination point in line 16
        of the (Include) program "ZTEST5".
    Source Code Extract
    Line  SourceCde
        1 REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.
        2
        3 TABLES: lfa1.
        4
        5 DATA: BEGIN OF xsl,
        6         lifnr TYPE lfa1-lifnr,
        7         name1 TYPE lfa1-name1,
        8         stras TYPE lfa1-stras,
        9       END   OF xsl.
       10
       11 DATA: xp_name1 TYPE lfa1-name1,
       12       xp_stras TYPE lfa1-stras.
       13
       14 TRY.
       15     EXEC SQL PERFORMING list.
    >>>>>       SELECT LIFNR, NAME1, STRAS
       17       INTO :xsl
       18       FROM LFA1
       19       WHERE UPPER( NAME1 ) LIKE :xp_name1
       20       AND UPPER( STRAS ) LIKE :xp_stras.
       21     ENDEXEC.
       22
       23   CATCH cx_sy_native_sql_error.
       24     WRITE: /1 'CX_SY_NATIVE_SQL_ERROR'.
       25   CATCH cx_sy_sql_error.
       26     WRITE: /1 'CX_SY_SQL_ERROR'.
       27   CATCH cx_dynamic_check.
       28     WRITE: /1 'CX_DYNAMIC_CHECK'.
       29   CATCH cx_root.
       30     WRITE: /1 'CX_SY_ROOT'.
       31 ENDTRY.
       32
       33 &----
       34 *&      Form  LIST
       35 &----
    Edited by: Klaus Babl on Oct 22, 2008 6:42 AM

  • SELECT on TIMESTAMP field from ABAP with EXEC SQL

    Hello,
    I'm trying to get a field of one table which is defined as TIMESTAMP. MaxDB parameter DATE_TIME_FORMAT is set to INTERNAL. When I do the SELECT in SQL Studio I get ISO format 'YYYY-MM-DD HH:MM:SS.MMMMMM' back. So I tried a SELECT with ISO in WHERE clause, but I'm always getting a shortdump with this error:
    Database error text........: "POS(82) Invalid date input value"
    Database error code........: "-3065"
    Then I did a SELECT without a WHERE clause in ABAP and got value '06-FEB-09' back from this field. So I tried with this ABAP statement and got no shortdump, but I also need to add time and not only the date.
      EXEC SQL.
        SELECT recv_time INTO :l_time FROM ztest WHERE sent_recv_time = '06-FEB-09'
      ENDEXEC.
    I'm using Native SQL because the SELECT is on a table which is not located in SAP Schema User. "SELECT recv_time FROM ztest WHERE recv_time = '2009-02-24 10:02:55.888000'" works in SQL studio, but not from ABAP.
    Does anyone know which format I need to specify in the WHERE clause?
    Regards
    Markus Karsch
    Edited by: Markus Karsch on Feb 26, 2009 4:22 PM

    >
    Thomas Theodor Koetter  wrote:
    > Hello Markus
    >
    > I don't know whether this will work from ABAP, but at least MaxDB can internally handle the ODBC literals for time, date and timestamp.
    >
    > Therefore literals like
    >
    > "{d'0001-02-03'}"
    > "{t'01:02:03'}"
    > "{ts'0001-02-03 04:05:06'}"
    >
    > might work. See [http://msdn.microsoft.com/de-de/library/ms190234(SQL.90).aspx]
    >
    >
    > HTH & regards  Thomas
    Hi Thomas,
    Thanks for your help. Unfortunately doesn't seem to work, I get following shortdumps (tried with 3 different notations):
    Database error text........: " "
    Database error code........: "-4005"
    Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
    xxx_xxxxxxxxx WHERE sent_recv_time = "{ts'2009-02-06 04:05:06'}""
    Database error text........: "POS(87) Invalid keyword or missing delimiter"
    Database error code........: "-3008"
    Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
    xxx_xxxxxxxxx WHERE sent_recv_time = '{ts' 2009-02-06 04:05:06 '}'"
    Database error text........: "POS(81) Missing value specification"
    Database error code........: "-5010"
    Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
    xxx_xxxxxxxxx WHERE sent_recv_time = { ts '2009-02-06 04:05:06.000' }"
    Regards
    Markus

  • Problems with exec() in Servlet

    Hi All,
    In my project i have used exec()in servlets to get the ouput from the c- program.I am using linux 8.0 and the server is tomcat-4.1.24.so that i try this following code:-
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ServletExecute extends HttpServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
    String[] command={"/bin/csh","-c","home/anand/Ananth/grpmaschk.run sptest S"};/*Here the grpmaschk.run is a c-program which genarates an output that is passed to sptest as parameter and S is a argument which indicates the action is done from Servlet*/
    res.setContentType("text/plain");
    PrintWriter out=res.getWriter();
    Process p=null;
    Runtime rt=Runtime.getRuntime();
    try
    p=rt.exec(command);//Executing the action on command string
    catch(Exception e)
    out.println("The Error Message is:"+e.getMessage());
    try
    FileInputStream fin=new FileInputStream("/home/Ananth/sptest");/*
    Once the output is generated from the c-program it will be stored in the sptest in /home/Ananth */
    BufferedReader br =new BufferedReader(new InputStreamReader(fin));
    String line=null;
    while((line=br.readLine())!=null)
    out.println(line); //From there i am reading the contents in it to be displayed in the browser
    } catch(Exception e1)
    out.println("The error message was:"+e1.getMessage());
    Whren it is displayed in the browser i am getting an error
    /home/Ananth/sptest not found which means that exec() is not working (or)executing.What is the problem here ???Plz. do provide a solution for this.It is quite Urgent.I will be waiting for ur replies.
    Thanx,
    m.ananthu

    Hi sir,
    Sorry for the mistake i did there but by using /home/....
    also the output is not coming.
    Here is the code again for ur reference:-
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ServletExecute extends HttpServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
    String[] command={"/bin/csh","-c","/home/anand/Ananth/grpmaschk.run","home/anand/Ananth/sptest S"};//corrected one
    res.setContentType("text/plain");
    PrintWriter out=res.getWriter();
    Process p=null;
    Runtime rt=Runtime.getRuntime();
    try
    p=rt.exec(command);
    catch(Exception e)
    out.println("The Error Message is:"+e.getMessage());
    try
    FileInputStream fin=new FileInputStream("/home/anand/Ananth/sptest");
    BufferedReader br =new BufferedReader(new InputStreamReader(fin));
    String line=null;
    while((line=br.readLine())!=null)
    out.println(line);
    } catch(Exception e1)
    out.println("The error message was:"+e1.getMessage());
    Here exec(....) is going through but the path in FileInputStream is showing an error.The error message i got when i run it in the browser is :-
    The error message was:/home/anand/Ananth/sptest (No such file or directory).Which means exec() function itself is not executed???. Is there any thing to do with security reasons or anything u need to configure in the tomcat configuration file??? Where i found that
    when i give /home/anand/Ananth/grpmaschk.run only in the exec() then the output is diaplyed in the browser.So i think exec() is workuing well but not with this huge argument
    String[] command={"/bin/csh","-c","/home/anand/Ananth/grpmaschk.run","home/anand/Ananth/sptest S"};
    Pls. do provide a solution for this problem.I will be waiting for ur replies.....
    Thanx,
    m.ananthu

Maybe you are looking for