Prepared statement upload from URL is wierd

//This doesnt save the picture
URL url = new URL(FromJPG);
URLConnection connection = url.openConnection();
InputStream is = connection.getInputStream();
int length = is.available();
BufferedInputStream in = new BufferedInputStream(is);
//THis works great
File snapshot = new File("/at/webuploads/asp_model.jpg");
          FileInputStream fileStream = new FileInputStream(snapshot);
Is there something special to get a picture from a URL and save to db. If i take this picture from the URL and write to filesystem, the pic is fine. It just wont save into db when its from a URL..any ideas?
Thanks

I figured it out. This is the end result.
//Get the image
URL url = new URL("http:yoururl.com/image/jpg");
URLConnection connection = url.openConnection();
InputStream is = connection.getInputStream();
BufferedInputStream in = new BufferedInputStream(is);
int length = in.available();
//Then add this to prepared statement
pstmt.setBinaryStream(13, in, (int)(in.available()));
Hope this helps someone download an image from a URL and insert into a database.

Similar Messages

  • How to retrieve a prepared statement from prepared statement cache?

    Hi All,
    I have created the connection pool during application server startup. The connection pool are getting created successfully. I have also created the prepared statements and stored as part of each connection in the connection pool.
    can anyone please tell me on how do I retrieve a prepared statement from prepared statement cache from a connection object.
    Any pointers to info source will be REALLY appreciated.
    Many Thanks in Advance,
    C R Baradwaj

    Raghuram Bharatwaj C wrote:
    Hi Joe,
    I have created a connection poool in my startup class and created the
    neccessary prepared statements for a each connection. I have 10 prepared
    statements to be created for each connection. I have created all the 10 prepared statements using the loop as mentioned below
    String [] epc_stmts;
    private java.sql.PreparedStatement[] _pstmts;
    if (epc_stmts!= null)
                   _pstmts = new PreparedStatement [len = epc_stmts.length];
                   for (i=0; i<len; i++)
                        _pstmts[i] = db.prepareStatement (epcstmts);
    I have closed the connection after the prepared statements are created.
    Now, How do i access a prepared statement from the connection object.
    Nothing. Are you talking about a WebLogic pool? If so, then therafter,
    whenever your application gets a pool connection, when it calls
    prepareStatement() with the same SQL as you prepared those statements,
    it will get a cached statement. Your array is unnecessary.
    Joe
    >
    Many Thanks in Advance,
    C R Baradwaj

  • List in prepared statement

    Hi there!
    How can I make this Prepared Statement:
    "select * from table where id_table in ?"
    the possible values for the ? should be something like this: (1, 2, 4, 7).
    Which method should I use to set the ?????
    Thanks in advance

    Look here:
    http://forum.java.sun.com/thread.jsp?forum=48&thread=221725&start=8
    That was my advice which the questioner choose.
    But please read the entire thread - maybe there are more good ideas hidden there.

  • How do I handle NULL returns from prepared statement?

    Thanks in advance to all those who respond. As a beginner with Java/JSP/JDBC, I need all the help I can get!
    Here's the problem...
    I'm using a prepared statement in JSP to query a MySQL database.
    If there is a value to return, everything works properly.
    If the query returns a NULL (empty set) value, I get the following error:
    javax.servlet.ServletException: Before start of result set
    Here's the code (no negative comments please...I know I'm violating some conventions! I'll restructure it later. Right now I just need help with handling the NULL case):
    <%
    Driver DriverAppt = (Driver)Class.forName(MM_test_DRIVER).newInstance();
    Connection ConnAppt = DriverManager.getConnection(MM_test_STRING,MM_test_USERNAME,MM_test_PASSWORD);PreparedStatement StatementAppt = ConnAppt.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id = " + Recordset1__MMColParam + " AND year = " + yy + " AND month = '" + months[mm] + "' AND date = " + dates[dd] + " AND appttime = '16:15:00'");
    ResultSet Appt = StatementAppt.executeQuery();
    boolean Appt_isEmpty = !Appt.first();
    boolean Appt_hasData = !Appt_isEmpty;
    Object Appt_data;
    int Appt_numRows = 0;
    %>
    Thanks for the help!!!

    I think I have a better handle on what's occurring here. To cut to the heart of the problem, I'm going to give a very simple example that illustrates what type of error handling I need.
    HERE'S THE EXAMPLE:
    Let's say that I have a database of users. There are only two columns in the database: user_id and lastname. There are only 2 users, user_id "1" has lastname "Jones" and user_id "2" has lastname "Smith".
    I built a very simple web interface that let's a user enter a number to see if there's a lastname associated with that record. The user has no way of knowing if the user_id exists or not, so they may or may not enter a valid number.
    If the user enters a valid user_id (in this case "1" or "2"), then the correct lastname is displayed. If the user enters an invalid user_id (in this case, anything other than "1" or "2") then I get the same "Before start of result set" error that I'm getting in my real application.
    So, the question is: WHERE IN THIS CODE WOULD I HANDLE THE RETURN OF AN EMPTY SET?
    The goal here is to have the sentence say "The user's lastname is .", basically returning null. If there has to be a value, then have the last sentence say "The user's lastname is unknown."
    If you can solve this simple example, you'll have also solved the problem with my main application!!!! :-)
    Here's the example code:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ include file="Connections/example.jsp" %>
    <%
    String Recordset1__MMColParam = "1";
    if (request.getParameter("user_id") !=null) {Recordset1__MMColParam = (String)request.getParameter("user_id");}
    %>
    <%
    Driver DriverRecordset1 = (Driver)Class.forName(MM_example_DRIVER).newInstance();
    Connection ConnRecordset1 = DriverManager.getConnection(MM_example_STRING,MM_example_USERNAME,MM_example_PASSWORD);
    PreparedStatement StatementRecordset1 = ConnRecordset1.prepareStatement("SELECT * FROM test_table WHERE user_id = " + Recordset1__MMColParam + "");
    ResultSet Recordset1 = StatementRecordset1.executeQuery();
    boolean Recordset1_isEmpty = !Recordset1.next();
    boolean Recordset1_hasData = !Recordset1_isEmpty;
    Object Recordset1_data;
    int Recordset1_numRows = 0;
    %>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <form action="test.jsp" method="get" enctype="application/x-www-form-urlencoded" name="form1" target="_self">
    <p> Submit a user id and a lastname will be displayed.</p>
    <p>
    <input type="text" name="user_id">
    <input type="submit" name="" value="Submit">
    </p>
    </form>
    <p>The User's lastname is <%=(((Recordset1_data = Recordset1.getObject("lastname"))==null || Recordset1.wasNull())?"":Recordset1_data)%>.</p>
    </body>
    </html>
    <%
    Recordset1.close();
    StatementRecordset1.close();
    ConnRecordset1.close();
    %>
    A huge "THANK YOU!!!!" to all those who've helped me here!!!

  • Ouput sql from prepared statement

    I'm using prepared statements and I want to output the sql that is being run in the statement to the console. For example:
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn = DriverManager.getConnection("jdbc:oracle:thin:@xx.xx.x.xx:xxxx:xxxx", "xxxx", "xxxx");
    stmt = conn.prepareStatement("update table set a = ? where b = ? and c = ?");
    stmt.setString(1, "a");
    stmt.setString(2, "b");
    stmt.setString(3, "c");
    System.out.println(?????????);So the statement would be something like: "update table set a = 'a' where b = 'b' and c = 'c'"
    How can I get the sql from the statement? I would have thought this would be easy but there doesn't seem to be any obvious method.

    I also came across the article about overpowering the PreparedStatement, neat stuff.
    But as I downloaded the classes and compiled them, I got some errors due to the fact that some methods from the PreparedStatement- and Statement-interfaces were not implemented by the DebuggableStatement-class.
    I suspect this has something to do with the JDK-version being used.
    I myself am using version 1.4.1_01-b01.
    Anyone came across this same problem?
    As I do want to compile under the version mentioned, I just insert the method(-stubs) myself. Or is this a bad idea?

  • Describe a parameter from a prepared statement

    With OCI programming, is it possible to describe a prepared statement parameter information such as the parm's OCI_ATTR_CHARSET_FORM? if possible how to check the parm information?
    example:
    sword rt;
    wchar_t* cmd = L"select * from b3 where c2 = :1";
    wchar_t* data = L"adfa";
    short indicator = 0;
    if(rt = OCIStmtPrepare(hpStmt, hpErr, (OraText*)cmd, (ub4)wcslen(cmd)*2, OCI_NTV_SYNTAX, OCI_DEFAULT))
    checkerr(hpErr, rt);
    iReturn = -1;
    goto EXIT;
    if(rt = OCIBindByName(hpStmt, &hpBind, hpErr, (OraText *)L":1", (sb4)4, (dvoid *)data, 4, SQLT_STR, (dvoid *)&indicator, 0, 0, 0, 0,OCI_DEFAULT))
    checkerr(hpErr, rt);
    iReturn = -1;
    goto EXIT;
    how to get parm :1 information?
    if parm :1 charset form is SQLCS_NCHAR, I need set the parm's charset form before execute the statement by:
    //ub1 cform = SQLCS_NCHAR;
    //OCIAttrSet(hpBind, (ub4) OCI_HTYPE_BIND, (dvoid *) &cform, (ub4) 0, (ub4) OCI_ATTR_CHARSET_FORM, hpErr);
    If I directly set parm's form to SQLCS_NCHAR, it would bring performance problem.
    Thanks

    String date;
    String sql = "Select Accepts.TimeOfAccept FROM Accepts where Accepts.TimeOfAccept = 'jComboBox2';";
    ResultSet result = stmt.executeQuery(sql);
    date = result.getString("TimeOfAccept");
    String day = date.substring(0, 2);
    String month = date.substring(3, 5);
    String year = date.substring(6);
    i have fixed it to a point but before i get the substring i am supposed to check the formats of the metadata in case the format of the date changes the query is supposed to build dynamically off the meta data as a but i dont know how to do this i am accessing an access database to test it initially but i will be moving it onto an sql database where the date format may differ
    thanking you in advance

  • Resultset from a batch select using prepared statement

    Hi,
    Is it possible to add results of batch execute of select statements and retrieve the result set ..
    I am running select statement in a batch mode setting in value for a column.I add this to a prepared batch.
    I would like to get the reults as a batch and spin through the result set like a r.next(). Is this possible ?
    I have given the code below
    sql = "select ordervalue , orderdate from discreet_orders "+
    "where order_no = ? ";
    dbObject.prepareStatement(sql);
    dbObject.prepareStatement(sql);
    for (int i=0; i < orderNoVect.size(); i++) {
    dbObject.setString(1,(String)scnV.elementAt(i));
    dbObject.addBatchPrepared();
    r = dbObject.execPrepared();
    dbObject.clearBatchPrepared();
    I would like to do a r.getNext() process the values form the resultset.
    Is this possible ? If not is there an other way to do it ?
    Thanks
    Arnold

    Olek wrote:
    hi
    Is there a way do a batch update using prepared statement?
    I don't want to insert every row in a single query...
    regards,
    OlekPossibly the confusion here stems from the existence of two addBatch methods in PreparedStatement.
    addBatch(String sql)inherited from Statement adds a new query to the batch of SQL statements for the statement. However you don't want to use this with PreparedStatements Instead you want
    addBatch()which adds the current set of parameters to the prepared statements batch of commands.
    In this scenario you prepare your query (insert statement) and then call setXXX(x,y) for each parameter and then addBatch for each tuple. Then call executeBatch to execute all the queries based on your batched parameters.
    If this didn't answer your question I don't know what your question is exactly. I would add that you probably want to set a "reasonable" size on your batches and break them into smaller batches as is reasonable. Mainly because the implementation of batched PreparedStatements widely varies depending on the database and driver, thus there are certainly scenarios where given enough batched parameters you could have various unpleasant things visited upon your program. Like terminal slowness, running out of memory, etc.

  • Show query from prepared statement

    Hi all!
    Does someone knows how to get the whole generated query from a prepared statement?
    I want to know if the parameters are set correctly and therefore want to print it out to screen
    before the query is executed.
    Thanks in advance.

    You can't. At least not using standard JDBC. This is partially because the driver doesn't necessarily generate a query from the prepared statement, it can make a remote procedure call instead, for example.
    Alin.

  • Escape Characters - simulate the setString from Prepared Statements

    I would like to see what the value of setString() is for a given prepared statement call.
    Because of reasons that would take me to long to explain that I cannot use preparedstatements with their parameters - I need a way to execute a query like the following:
    String query = "insert into blahtable (somestring) values (\"asdfds\'\s sdsfdasfd \"\& ...\");
    PreparedStatement stmt = connection.prepareStatement(query);
    I know prepared statements can take care of this, but I want to know and write the query as above without the need of prepared statements help for string.
    Below is an example with prepared statement - but not what I want to do
    For example:
    String oddstringwithunusalcharacters = "...";
    String query = "insert into blahtable (somestring) values (?)";
    PreparedStatement stmt = connection.prepareStatement(query);
    stmt.setString(1, oddstringwithunusalcharacters);
    I would like to see what the actual query looks like and what the actual string was passed:
    --> insert into blahtable (something) values ("asdfds\'\s sdsfdasfd \"\& .... ")
    It is not sufficient enough for me to escape quotes and apostrophes because there maybe other unusual characters that I do not know of since the string is passed by an unknown source.
    Thank you in advance

    PreparedStatements actually doesn't escape quotes. It basically precompiles statements in the DB and only passes the values to the DB.
    But if you're using a plain vanilla SQL statement where you quote the string with a single quote ' then you need to escape all occurrences of exactly the same single quote ' in the actual String value. If you for example quote the string with an apostrophe ` then you just need to escape all occurrences of exactly the same apostrophe ` in the actual String value. And so on. It is nothing more than logical, is it?

  • Prepared statement not releasing from access db

    Hello all,
    I have several prepared statements like the following:
    public void storeUpdate(String userId,String ws,String wm,String wl,String wx,String wxx,String bs,String bm,String bl,String bx,String bxx, String tq, String tp,Timestamp ts)
         String updatePurchase = "UPDATE store SET smallWhite=?,medWhite=?,lrgWhite=?,xlrgWhite=?,xxlrgWhite=?,smallBlue=?,medBlue=?,lrgBlue=?,xlrgBlue=?,xxlrgBlue=?,totalQty=?,totalPrice=?,ot=? WHERE playerNo='"+userId+"'";
         try{
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
             objConn = java.sql.DriverManager.getConnection("jdbc:odbc:myDB","","");
             PreparedStatement ps = objConn.prepareStatement(updatePurchase);
             ps.setString(1, ws);
             ps.setString(2, wm);
             ps.setString(3, wl);
             ps.setString(4, wx);
             ps.setString(5, wxx);
             ps.setString(6, bs);
             ps.setString(7, bm);
             ps.setString(8, bl);
             ps.setString(9, bx);
             ps.setString(10, bxx);
             ps.setString(11, tq);
             ps.setString(12, tp);
             ps.setTimestamp(13,ts);
             ps.executeUpdate();
             ps.close();
             objConn.close();
                catch (SQLException s)
                    System.err.println("DataBase PROBLEM");
                    s.printStackTrace();
                catch (Exception e)
                        System.err.println("Error in updateStore method");
                        e.printStackTrace();
    } The prepared stmts seem to be "hanging on to" the access(dont laugh)table that the prepared stmt just updated. The reason I know this is because when I try to look at the table in access's design view I get a message saying:
    "Microsoft access
    You cant open the table 'store' for modification.
    A query or form bound to the table is open, you may not have permission to open this table in design view, or another user has the table open.
    If you have opened a query or form bound to this table, close it, and then try again to open the table in design view."
    The only way to open the table in design view is to shut down tomcat and restart.
    Should I be worried about this?
    Am i forgetting to close something in my ps?
    TIA!!

    I use PreparedStatement all the time with Access and never have a problem. The only thing I noticed about your code is that if an exception gets thrown in your method, the close statements won't get executed. This might leave the tables locked. You might want to try moving the close statements into a finally block. That way your statement and connection will get closed if an exception gets thrown or not.

  • Error in uploading BDC Models (Server name missing from URL in Property wcfmexURL)

    Hi,
    We are using multiple Dialogue Instances in DUET Enterprise.
    Problem: Before we did the Reverse Proxy Configuration for App Servers, Our BDC Models got imported in SharePoint Successfully (Correct WSS Setup and STS Urls) but After doing the Reverse Proxy Configurations, when we regenerated the BDC Models, apparently Server Name is missing from URL of the Propoerty "wcfmexurl".
    Below is the Error Text:
    [ERROR] The LobSystem (External System) / LobSystemInstance (External System Ins
    tance) Property with Name 'WcfMexDocumentUrl' has an invalid value 'https/sap/bc
    /srt/wsdl/bndg_CF37C550B825080AE1000000AC1F18FD/soap12/wsdl11/allinone/ws_policy
    /document?sap-client=400'.
        Error was encountered at or just before Line: '65' and Position: '20'.
    Failed to import model: Role
    [ERROR] The LobSystem (External System) / LobSystemInstance (External System Ins
    tance) Property with Name 'WcfMexDocumentUrl' has an invalid value 'https/sap/bc
    /srt/wsdl/bndg_CE38C550B825080AE1000000AC1F18FD/soap12/wsdl11/allinone/ws_policy
    /document?sap-client=400'.
        Error was encountered at or just before Line: '42' and Position: '20'.
    Failed to import model: UserRoles

    Hi Holger,
    Thanks a lot!
    This Error is gone after implementing the Note. Now the generated BDC Models have the correct URL for wcfmexURL property.
    now we have the Following Error:
    [ERROR] Error loading URL 'https://sapbwX.srv.XXX.com/sap/bc/srt/wsdl/bndg_92
    38C550B825080AE1000000AC1F18FD/soap12/wsdl11/allinone/ws_policy/document?sap-cli
    ent=XXX'. This normally happens when URL does not point to a valid discovery doc
    ument, service description, or XSD schema.
        Error was encountered at or just before Line: '48' and Position: '20'.
    Failed to import model: Account
    For this Error, our SharePoint Administrator is checking below Steps.
    1.    1) Open “wcfmexDocumentUrl” URL in the browser and copy all SSL certificates (including Root Certificates) to a file. Then import these certificates in the Trust Relationships section. Then try the import of the BDC Models
    2.   
    2) 2) Verifying Your server uses a virtual hostname and all the configuration (e.g. SSL certificate) is done for this virtual hostname. Also the URLs that are created and used in the BDC model are Same virtual hostnames, but not the ones from the physical server.
    3.  3)Re-verify SAML Authentication type and transport security at SAP.
    4) 4) Browse WSDL at SharePoint Server and verify “WSP:Policy”  and in WSDL make sure that it contains an entry:
    <sp:RequestSecurityTokenTemplate>
    <wst:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</wst:KeyType>
    <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>
    </sp:RequestSecurityTokenTemplate>
    I will update the Results after these checks!
    Thanks,
    Saumil

  • Problem with Prepared Statement & MS Access

    Hi
    I have tried to find some info about this but can't see anything specific to what I think the problem may be. Hopefully someone can point me in the right direction.I am trying to get information out of an MS Access database using a Prepared Statement but I am getting strange results.
    When I run the query in the database it gives me the correct totals (�51) for 4 records. When I run the Prepared Statement ,I get 81. Has it got anything to do with the data type I am using( sorry if this is a really basic question). here is my code- the connection etc is elsewhere.
    private void getReportMoneyTotal() throws SQLException
              Calendar todayTotal =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement preparedT =context.getConnection().prepareStatement(
                   "SELECT Sum(tblSession.Fee) AS Total, Count(tblBooking.BookingID) AS CountOfBookingID FROM tblSession INNER JOIN "+
                   "(tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON tblSession.SessionID = tblBooking.SessionID "+
                   "WHERE (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(todayTotal.getTime())+"#)) AND ((tblSession.Session)='Morning' Or (tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultTotal =preparedT.executeQuery();
              resultTotal.next();
              Double total =resultTotal.getDouble("Total");
              Locale locale = new Locale("GBP");
            NumberFormat gbpFormat = NumberFormat.getCurrencyInstance(locale);
              System.out.println(gbpFormat.format(total));
              preparedT.close();
         }I do realise that my code probably isn't very elegant but I'm only learning!

    Hi Matt--
    I am not clear if you are saving the url with the # # around
    the text or if
    the
    data already contains the # marks.
    When you insert a link, you want to make sure you insert is
    insert into table ( link1) values ( <cfqueryparam
    cfsqltype="cf_sql_varchar"
    value='#linkvaluehere#'> )
    remember to
    1) enclose your data's value inside quotes (some databases
    are picky about
    single v. double quotes).
    2) if it IS in quotes, swap doubles for singles and see if
    that helps.
    3) make sure your data being saved is NOT double hashed like
    '##linkvalueher##'. Double ##'s tell
    Coldfusion not to treat it as a variable.
    hope his helps,
    tami
    "Mattastic" <[email protected]> wrote in
    message
    news:f9c7h0$8ub$[email protected]..
    | Hi Folks,
    |
    | I'm storing a link in a nvarchar field in SQL server,
    www.foo.co.uk, it
    looks
    | and works fine in SQL server. Problem occurs when I setup
    an ADP in Access
    and
    | insert links. Certain links have a hash symbol around them.
    so
    |
    http://www.foo.co.uk, would be #
    http://www.foo.co.uk# which is
    causing
    problems.
    |
    | Can anyone tell me why this is happening? and how to stop
    it?
    |
    | Thankyou
    |

  • Beginner question about prepared statements...PLEASE help! :-)

    First let me say thanks for the assistance. This is probably really easy to do, but I'm new to JSP and can't seem to figure it out.
    I want to dynamically populate a table that shows whether a particular person has an appointment at a given date and time with a user. To do this, I want to query the MySQL database for the lastname of the person with the appointment that occurs with the user at the year, month, date, and time, in question.
    THE CODE BELOW DOESN'T WORK (obviously) BUT SOMEWHAT ILLUSTRATES WHAT I'M TRYING TO ACCOMPLISH:
    <%
    Driver DriverTestRecordSet = (Driver)Class.forName(MM_website_DRIVER).newInstance();
    Connection ConnTestRecordSet = DriverManager.getConnection(MM_website_STRING,MM_website_USERNAME,MM_website_PASSWORD);
    PreparedStatement StatementTestRecordSet = ConnTestRecordSet.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id='<%=(((Recordset1_data = Recordset1.getObject(user_id))==null || Recordset1.wasNull())?"":Recordset1_data)%>' AND year='<%= yy %>' AND month='<%= months[mm] %>' AND date='<%= dates[dd] %>' AND appttime='16:15:00'");
    ResultSet TestRecordSet = StatementTestRecordSet.executeQuery();
    boolean TestRecordSet_isEmpty = !TestRecordSet.next();
    boolean TestRecordSet_hasData = !TestRecordSet_isEmpty;
    Object TestRecordSet_data;
    int TestRecordSet_numRows = 0;
    %>
    The real problem comes in the prepared statement portion. If I build the prepared statement with static values like below, EVERYTHING WORKS GREAT:
    PreparedStatement StatementTestRecordSet = ConnTestRecordSet.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id='1' AND year='2002' AND month='October' AND date='31' AND appttime='16:15:00'");
    But when I try to use dynamic values, everything falls apart. It's not that the values aren't defined, I use the user_id, year <%= yy %>, month <%= months[mm] %>, etc. elsewhere on the page with no problems. It's just that I can't figure out how to use these dynamic values within the prepared statement.
    Thanks for reading this far and thanks in advance for the help!!!!

    Hi PhineasGage
    You are little bit wrong in your
    your preparedStatement.
    Expression tag within scriptlet tag is invalid.
    Whenever you are appending the statement with
    expression tag, append it with "+" and remove
    expression tag.
    Hopefully it will work
    ThanksThanks for the response!
    I know that the expression tag within scriptlet tag is invalid. I just need a workaround for what I want to do.
    I'm unclear what you mean by "Whenever you are appending the statement with expression tag, append it with a "+" and remove expression tag".
    Could you give an example?
    In the meantime, I've been trying to digest the docs on prepared statements and have changed the code to look like:
    PreparedStatement StatementTestRecordSet = ConnTestRecordSet.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id= ? AND year= ? AND month= ? AND date= ? AND appttime='13:15:00'");
    StatementTestRecordSet.setInt(1,1);
    StatementTestRecordSet.setInt(2,2002);
    StatementTestRecordSet.setString(3,"October");
    StatementTestRecordSet.setInt(4,31);
    Again, WITH THE STATIC VALUES, THIS WORKS FINE...but when I try to use expressions or variables like below, things don't work:
    StatementTestRecordSet.setInt(2,<%= yy %>);
    Obviously, I'm doing something wrong, but there has to be a way to use variables within the prepared statement.
    ALSO, the values are being passed to this page via URL in the form:
    samplepage?user_id=1&year=2002&month=October&date=31
    Based upon this information, is there another way (outside of stored procedures in the db) to do what I want to do? I'm open to ideas.

  • Prepared Statement nested calls (Oracle)

    I have a prepared statement like
    select type
    , id
    from ms_page_position where page_id =
    (select id from ms_url where url = ?)
    and column_id =
    (select id from ms_column where name = ?)
    and preview = ? order by position asc.
    If i place in
    pstmt.setString(1, "/news/");
    pstmt.setString(2, "RIGHTCOLUMN");
    pstmt.setString(3, "Y");
    res = pstmt.executeQuery();The three fields are strings
    i get this error -
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested.
    If i use a straight statement object and concatenate strings then i have no problem. Can you use prepared statements with nested selects - ?
    Cheers

    I've exactelly the same problem. Any ideas how to solve this. Concatenation works fine but two setString() on PS couses this exception.

  • Missing the Personalizations while uploading from 11i to R12

    Hi,
    I am working on the Upgrade project . We are upgrading the Oracle applications from 11.5.10.2 to 12.1.2 . So i am uploading the all personalizations from 11i to R12.
    I created the ldt file from 11i and and tried to upload in R12. But some of the functions are missed in R12 so the Count is not matched as per the 11i personalizations. I checked in the meta link and they suggested the patch p9446215_R12.FND.B_R12_GENERIC.Zip for R12.
    So i tried with latest lct file which is provided with patch also i am missing some data after uploading in the R12. when i check the log file after uploading the data, it is throwing some error. I am mentioning the error below.
    I tried to Upload form level as well as Function level. In both ways count of personalizations are not matched.
    Application Object Library: Version : 12.0.0
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    module:
    Current system time is 15-FEB-2012 05:24:55
    Uploading from the data file CSXSRISV_15022012_FF.ldt
    Altering database NLS_LANGUAGE environment to AMERICAN
    Dump from LCT/LDT files (/tmp/naga/affrmcus.lct(120.3.12010000.4), CSXSRISV_15022012_FF.ldt) to stage tables
    Dump LCT file /tmp/naga/affrmcus.lct(120.3.12010000.4) into FND_SEED_STAGE_CONFIG
    Dump LDT file CSXSRISV_15022012_FF.ldt into FND_SEED_STAGE_ENTITY
    The value cannot be uploaded without a prepare statement
    The value cannot be uploaded without a prepare statement
    The value cannot be uploaded without a prepare statement
    Dumped the batch (FND_FORM_CUSTOM_RULES 121 , FND_FORM_CUSTOM_SCOPES 281 30 MAINTENANCE_PROTECTION ) into FND_SEED_STAGE_ENTITY
    Upload from stage tables
    Concurrent request completed successfully
    Current system time is 15-FEB-2012 05:25:06
    Thanks on Advance,
    Nag.

    Hello,
    This is the standalone "Forms" forum. For Personalization questions, use the E-Busines Suite forum.
    Francois

Maybe you are looking for

  • Can i put NET Bible on my ipod touch

    i was wondering if i could put the NET Bible on my ipod touch or it is it just for the iphone?

  • Safari 6 and proxy

    updated MBP to 10.8.2, and ISO6 on iPad3, safari on both device started having problems behind proxy server. 1st, 10.8.2 desnot remember proxy user name and password anymore. every time i put in my username and password, it wil be gone(got erased its

  • Imp full in a populated db.

    Hi all. I have a full export of my production db and I like to import to the development db in order to have the same data. I want to know If I can do the import full directly or I must delete the users or the object in the shcemas that are already c

  • Installing Win version on Mac via Parallels

    I'm currently running Photoshop CS2 and the trial version of Illustrator CS4 on my Mac. I'm going to be purchasing Creative Suite for Windows and installing/running this via Parallel, which allows you to run a Windows OS and it's programs on a Mac. M

  • Transfer iWeb files from Older machine to new machine

    Hi I have just upgraded from my powerbook to a MBP, and can't seem to find where the iWeb files are stored, as I need those to carry on updating my family website, (I don't have a .mac account). Where are the files kept and is it as easy as just copy