CallableStatement: how to get prepared call string?

How can I get the parameter string that is set via prepareCall() from a CallableStatement?
String call = "{call sp_irecord (?,?,?)}";
CallableStatement cs = connection.prepareCall(call);
//later, when 'call' is not known but cs:
String originalCall = csc.get???();
//how to get the call string from the callable statement?

i don't mean the parameter names or values, i mean the string that you set with the prepareCall() method:
String call = "{call sp_irecord (?,?,?)}";
CallableStatement cs = connection.prepareCall(call);
System.out.println("Call string: "+cs.getCallString());with the method getCallString() (that i invented and that i'm looking for) should return the exact string. The output of the example above should be:
Call string: {call sp_irecord (?,?,?)}

Similar Messages

  • How to get an XML string store in CLOB or LONG column ?

    How to get an XML string store in CLOB or LONG column ?
    We use XSU with the following command
    String str = qry.getXMLString();
    but all the "<" are replace by "&lt;"
    It's impossible to parse the result for XSLT transformation
    Thank's for your help
    Denis Calvayrac
    Example :
    in the column "TT_NAME"
    "<name><firstname>aaa</<firstname><lastname>bbb</lastname></name>
    I want this result
    <TT_NAME>
    <name>
    <firstname>aaa</firstname>
    <lastname>bbb</lastname>
    </name>
    </TT_NAME>
    but, I have this result
    <TT_NAME>
    &lt;name&gt;
    &lt;firstname&gt;aaa&lt;/firstname&gt;
    &lt;lastname&gt;bbb&lt;/lastname&gt;
    &lt;/name&gt;
    </TT_NAME>

    Can you post some of your code, so I can take a look ?
    Thanks

  • How to get skype call history

    How to get skype call history?
    My Calls I made, Received and thier cost.

    Suresh.Salver wrote:
    How to get skype call history?
    My Calls I made, Received and thier cost.
    Hello
    Visit your account page and click on "Usage".
    TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
    I recommend that you always run the latest Skype version: Windows & Mac
    If my advice helped to fix your issue please mark it as a solution to help others.
    Please note that I generally don't respond to unsolicited Private Messages. Thank you.

  • Can any body tell me how to get a call for adobe interview for a flex developer post for 2.6 years??

    can any body tell me how to get a call for adobe interview for a flex developer post for 2.6 years??

    hi,
    there's some microsoft support to this issue. check here http://support.microsoft.com/kb/2008385 
    regards.
    From out of Nowhere

  • How to get an XML string from a Java Bean without wrting to a file first ?

    I know we can save a Java Bean to an XML file with XMLEncoder and then read it back with XMLDecoder.
    But how can I get an XML string of a Java Bean without writing to a file first ?
    For instance :
    My_Class A_Class = new My_Class("a",1,2,"Z", ...);
    String XML_String_Of_The_Class = an XML representation of A_Class ?
    Of course I can save it to a file with XMLEncoder, and read it in using XMLDecoder, then delete the file, I wonder if it is possible to skip all that and get the XML string directly ?
    Frank

    I think so too, but I am trying to send the object to a servlet as shown below, since I don't know how to send an object to a servlet, I can only turn it into a string and reconstruct it back to an object on the server side after receiving it :
    import java.io.*;
    import java.net.*;
    import java.util.*;
    class Servlet_Message        // Send a message to an HTTP servlet. The protocol is a GET or POST request with a URLEncoded string holding the arguments sent as name=value pairs.
      public static int GET=0;
      public static int POST=1;
      private URL servlet;
      // the URL of the servlet to send messages to
      public Servlet_Message(URL servlet) { this.servlet=servlet; }
      public String sendMessage(Properties args) throws IOException { return sendMessage(args,POST); }
      // Send the request. Return the input stream with the response if the request succeeds.
      // @param args the arguments to send to the servlet
      // @param method GET or POST
      // @exception IOException if error sending request
      // @return the response from the servlet to this message
      public String sendMessage(Properties args,int method) throws IOException
        String Input_Line;
        StringBuffer Result_Buf=new StringBuffer();
        // Set this up any way you want -- POST can be used for all calls, but request headers
        // cannot be set in JDK 1.0.2 so the query string still must be used to pass arguments.
        if (method==GET)
          URL url=new URL(servlet.toExternalForm()+"?"+toEncodedString(args));
          BufferedReader in=new BufferedReader(new InputStreamReader(url.openStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
        else     
          URLConnection conn=servlet.openConnection();
          conn.setDoInput(true);
          conn.setDoOutput(true);           
          conn.setUseCaches(false);
          // Work around a Netscape bug
          conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
          // POST the request data (html form encoded)
          DataOutputStream out=new DataOutputStream(conn.getOutputStream());
          if (args!=null && args.size()>0)
            out.writeBytes(toEncodedString(args));
    //        System.out.println("ServletMessage args: "+args);
    //        System.out.println("ServletMessage toEncString args: "+toEncodedString(args));     
          BufferedReader in=new BufferedReader(new InputStreamReader(conn.getInputStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
          out.flush();
          out.close(); // ESSENTIAL for this to work!          
        return Result_Buf.toString();               // Read the POST response data   
      // Encode the arguments in the property set as a URL-encoded string. Multiple name=value pairs are separated by ampersands.
      // @return the URLEncoded string with name=value pairs
      public String toEncodedString(Properties args)
        StringBuffer sb=new StringBuffer();
        if (args!=null)
          String sep="";
          Enumeration names=args.propertyNames();
          while (names.hasMoreElements())
            String name=(String)names.nextElement();
            try { sb.append(sep+URLEncoder.encode(name,"UTF-8")+"="+URLEncoder.encode(args.getProperty(name),"UTF-8")); }
    //        try { sb.append(sep+URLEncoder.encode(name,"UTF-16")+"="+URLEncoder.encode(args.getProperty(name),"UTF-16")); }
            catch (UnsupportedEncodingException e) { System.out.println(e); }
            sep="&";
        return sb.toString();
    }As shown above the servlet need to encode a string.
    Now my question becomes :
    <1> Is it possible to send an object to a servlet, if so how ? And at the receiving end how to get it back to an object ?
    <2> If it can't be done, how can I be sure to encode the string in the right format to send it over to the servlet ?
    Frank

  • How to get password as string back from encrypted password byte array.

    Hi All,
    I am storing encrypted password and enc key in the database.(Code included encryptPassword method for encryption and validatePassword method for validating of password). Problem is that for some reason i need to show user's password to the user as a string as he/she entered. But i am not able to convert the encrypted password from D/B to original String.
    Tell me if any body know how to get the string password back from the encrypted password byte array after seeing my existing encryption code.
    //********* Code
    private Vector encryptPassword(byte[] arrPwd)
    try
    // parameter arrPwd is the password as entered by the user and to be encrypted.
    byte[] encPwd = null;
    byte[] key = null;
    /* Generate a key pair */
    KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA", "SUN");
    SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");
    keyGen.initialize(1024, random);
    KeyPair pair = keyGen.generateKeyPair();
    PrivateKey priv = pair.getPrivate();
    PublicKey pub = pair.getPublic();
    /* Create a Signature object and initialize it with the private key */
    Signature dsa = Signature.getInstance("SHA1withDSA", "SUN");
    dsa.initSign(priv);
    /* Update and sign the data */
    dsa.update(arrPwd, 0, 12);
    /* Now that all the data to be signed has been read in, generate a signature for it */
    encPwd = dsa.sign();
    /* Now realSig has the signed password*/
    key = pub.getEncoded();
    Vector vtrPwd = new Vector(2);
    vtrPwd.add(encPwd);
    vtrPwd.add(key);
    return vtrPwd;
    catch (Exception e)
    private boolean validatePassword(byte[] arrPwd,byte[] encPwd,byte[] key) throws RemoteException
    try
    // arrPwd is the byte array of password entered by user.
    // encPwd is the encrypted password retreived from D/B
    // key is the array of key through which the password was encrypted and stored.
    X509EncodedKeySpec KeySpec = new X509EncodedKeySpec(key);
    KeyFactory keyFactory = KeyFactory.getInstance("DSA", "SUN");
    PublicKey pubKey = keyFactory.generatePublic(KeySpec);
    /* Encrypt the user-entered password using the key*/
    Signature sig = Signature.getInstance("SHA1withDSA", "SUN");
    sig.initVerify(pubKey);
    /* Update and sign the password*/
    sig.update(arrPwd, 0, 12);
    return sig.verify(encPwd);
    catch (Exception e)
    Help upto any extent would be appreciated.
    Thanx
    Moti Singh

    Hi All,
    I am storing encrypted password and enc key in the
    database.(Code included encryptPassword method for
    encryption and validatePassword method for validating
    of password). Problem is that for some reason i need
    to show user's password to the user as a string as
    he/she entered. But i am not able to convert the
    encrypted password from D/B to original String.No, you are not encrypting the password in your code, you are merely signing it.
    Tell me if any body know how to get the string
    password back from the encrypted password byte array
    after seeing my existing encryption code.It is impossible to retrieve the original text out of a signature.
    You should read up on some encryption basics in order to understand the difference between signing and encrypting. Then you can find examples of how to encrypt something here: http://java.sun.com/j2se/1.4/docs/guide/security/jce/JCERefGuide.html.
    Actually there is one class specifically for keeping keys secure, KeyStore http://java.sun.com/j2se/1.4/docs/api/java/security/KeyStore.html
    - Daniel

  • How to get substring from string using index?

    hi,
    here i am having string ,
    i want the pullareddy from below line ,
    i know how to get from substring.
    but i want to get the above using "index",
    can any help how to do it?
    String str1="janapana,pullareddy, in malaysia";
    jpullareddy

    get the start index with indexAt("pullareddy")
    get the end index with adding the length of the word to the start
    get the char[] of str1 with toCharArray()
    make a new string with the chars from start to end index.

  • How to get or call PCR form in workflow template.

    Hi All,
    I'm working in ESS and MSS workflow now. For my requirement, I need to get or call PCR form in workflow template. How can I achieve this.
    Thanks - Krish

    Hi Raj,
    Check if the following links helps you:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50d1cb99-46cf-2b10-8880-85004a301283
    PCR workflow
    Regards,
    Saumya

  • How to get incoming call number in j2me

    hi all,
    Is there any way to get incoming call number in j2me???
    thanks in advance
    mraj

    You can't get this number at least till MIDP 2.0 devices.. you only have a interrupt events which call showNodify and hideNotify, pauseApp or start methods. Once can neither know if this interrupt is due to phone call, user switching to menu or sms etc..
    Regards,
    Raja Nagendra Kumar

  • How to get my call history

    Is there a way I can get my call history for December 2013?

    Hi,
    You should be able to access your call history in client, by going to the contact and then clicking on view history from however long ago you need it for. If you deleted it it is very unlikely you can get it back.
    You can try getting in touch with Skype Customer Support, but they might not be able to help either.
    Anthony
    This post was by Anthony- I do not work for Microsoft!
    If this solved your issue - Mark it as a solution! If you like my post - Please add Kudos!
    Spotify Community Profile - Anthony
    Feel free to PM me - Here

  • How to get prepared string before sending to sql

    Hi
    I want the prepared string before sending to Sql (After substitution and setXXX), is it possible to do this? if yes, how ?
    PreparedStatement ps = cn.prepareStatement("select * from table1 where name= ''?'' ");
    ps.setString(1, "mytable")
    <-- I want the prepared string before sending to Sql (After substitution and setXXX) -->
    ResultSet rs = ps.executeQuery();
    Thanks
    Ali

    As I mentioned, I want Sql Text before execution
    n (getting resultSet), and after whole of setXXXs,No way, I believe.
    I have tried in many ways, let me put down my work.
    String query = "'Select * from dept where deptno=?'";
    System.out.println("Before : "+query);
    PreparedStatement ps = con.prepareStatement("select "+query+",? from Dual");
    ps.setInt(1,50);
    ResultSet rs = ps.executeQuery();
    if(rs.next()) {
    System.out.println("After : "+rs.getString(1));
    ps.close();
    con.close();I have tried in these lines, to capture the sql query, but it is failing at execution and the exception is 'bind variable not found'. So, I think you need to implement your own class to construct this query. Getting the details from DatabaseMetadata to see how the driver's setter methods works and you can use the same logic in your custom class.
    Good luck.

  • How to get a SQL-String from a (Prepared)Statement?

    Hi,
    I have these three lines of code:
    PreparedStatement stmt = connection.prepareStatement("select * from mytable where username= ?");
    stmt.setString(1, "user");
    ResultSet rs = stmt.executeQuery();
    Now, I want to log all SQL-Statements with log4J.
    log.info(sqlstring);
    Now, I want for sqlstring something like "select * from mytable where username='user' ", i. e. the PreparedStatement-String with the parameters I set.
    Is there any possibility to get this string?
    I searched in class PreparedStatement, in class ResultSet, in class ResultSetMetaData, but without success.
    Can anybody help me?

    Use a JDBC-logging library. You can use Mimer JTrace available att http://developer.mimer.com (or http://developer.mimer.se/downloads/downloads_thank.tml?a=&id=36). It should work with any JDBC driver.
    /Fredrik

  • CallableStatement,  how to get function result ?

    Hello all,
    I know that this issue more relevant to JDBC, but it seems that their forum is more "sleepy" than that one therefor i trying my luck here with you...
    I've a pl/sql function which get 2 int arguments, and return float result
    I use CallableStatement in order to execute pl/sql function.
    with CallableStatement.setInt i transfer argument to the function,
    but i dont know how to "catch" function result (as i said earlier, function results is float)
    any help here...
    Thanks
    Edited by: igalep132 on Nov 21, 2009 4:47 AM

    igalep132 wrote:
    If you do have a PL/SQL function (specific syntax in PL/SQL) then you use the following form from the javadocs.
    {?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
    [http://java.sun.com/javase/6/docs/api/java/sql/CallableStatement.html]
    that's exactly what i did, but my teacher assistant told me that it's wrong, because CallableStatement uses for stored Procedures, but I have here a function (because it returns a value...) therefor i need to use PrepareStatment/Statement...Third person accounts are always hard to judge, but what you are claiming is wrong (whether the TA said it or not.)
    First a prepared statement can in fact be used to run either a proc or function. So can statement for that matter.
    However callable statement is provided as a convenience to run procs and functions.
    There can however be reasons why a driver doesn't allow that - I have used a driver that didn't support callable statements at all (procs or functions.)
    That said the the format I gave you is specifically modeled for functions.

  • How to get InputStream from String ?

    Hi !
    I want to get InputStream object from String.
    String str = "balabalabala";
    InputStream stream = getInputStream(str);
    How to realize getInputStream(str) function ?
    Thanks!

    The preferred method nowadays is to use Readers and Writers for String data - hence StringReader(String). If you're going to operate on the InputStream directly, then I'd modify your code to use the Reader calls and go that route.
    If, however, you need to pass the InputStream to some other piece of API that requires an InputStream instead of a Reader, then the ByteArrayInputStream is probably your best bet. StringBufferInputStream is deprecated because it doesn't work reliably in the face of many character encodings.
    Speaking of encodings - never call Strng.getBytes() - always use the getBytes(character-encoding) version, so you KNOW what encoding you're getting!
    Grant

  • How to get a global string value to be the value of a JSF output box?

    im useing Jdeveloper 10 i have made a JSF, JSP page i have a backing bean for that page. in there i have made a global value:
    private string test = "TESTING"these codes have been generated:
    public void setTester(HtmlOutputText outputText6) {
    this.tester = outputText6;
    public HtmlOutputText getTester() {
    return tester;
    }now how do i put test as the output text?

    That wouldn't even compile. HtmlOutputText isn't a subclass of String (heck, java.lang.String is a final class).
    Two ways to solve this: 1) use HtmlOutputText#setValue() in the constructor or initialization block of the bean or even by lazy loading in the getter. Just create a String getter and use it in the value attribute of the outputText element in the JSF page.

Maybe you are looking for