Saving sessions in the database...

Hi there, I'm trying to save a session object ( not a J2EE session but a custom one ) in an Oracle database. I save the session in a table with a BLOB column and some other varchar columns... Whenever I want to write a blob, the application freezes... When I want to read a file, it's ok... Anyone knows of this problem? Here is the code of my write method:
  private void writeSession(CapSession pSession) throws Exception
    static final String writeObjSQL      = "BEGIN " +
                                         "  INSERT INTO intranet_sessions(session_id, session_last_access, session_timeout, session_value) " +
                                         "  VALUES (?, ?, ?, empty_blob()) " +
                                         "  RETURN session_value INTO ?; " +
                                         "END;";
    CallableStatement stmt = conn.prepareCall(writeObjSQL);
    stmt.setString(1, pSession.getSessionId() + pSession.getPassword());
    stmt.setLong(2, pSession.getLastAccess());
    stmt.setLong(3, pSession.getTimeout());
    stmt.registerOutParameter(4, java.sql.Types.BLOB);
    stmt.executeUpdate();
    BLOB blob = (BLOB) stmt.getBlob(4);
    OutputStream os = blob.getBinaryOutputStream();
    ObjectOutputStream oop = new ObjectOutputStream(os);
    oop.writeObject(pSession);
    oop.flush();
    oop.close();
    os.close();
    stmt.close();
    conn.commit();
}Thanks!

Try this
conn.setAutoCommit(false);
PreparedStatement pstmtIns = conn.prepareStatement
               ("INSERT INTO intranet_sessions" +
                    "(session_id, session_last_access, session_timeout, session_value) " +
" VALUES (?, ?, ?, empty_blob()) ");
pstmt.setString(1, pSession.getSessionId() + pSession.getPassword());
pstmt.setLong(2, pSession.getLastAccess());
pstmt.setLong(3, pSession.getTimeout());
pstmt.execute();
PreparedStatement pstmtSel = conn.prepareStatement
               ("select session_value from intranet_sessions where session_id = ? for update");
pstmtSel.setString(1, pSession.getSessionId() + pSession.getPassword());
ResultSet rs = pstmtSel.executeQuery();
while(rs.next())
     BLOB blob = (BLOB) rs.getBlob(1);
     OutputStream os = blob.getBinaryOutputStream();
     ObjectOutputStream oop = new ObjectOutputStream(os);
     ObjectOutputStream oop = new ObjectOutputStream(os);
     oop.writeObject(pSession);
oop.flush();
}

Similar Messages

  • Error message: "Querying or saving changes to the database failed."

    Hi all,
    I can sense I'm becoming a regular on this particular forum - the problem of spending 8 hours a day trying to get this software working!
    _*The problem*_
    When i try and setup a new device, or modify an existing one, I get an error message when i get to the Transcode Settings page. The error message is "Querying or saving changes to the database failed." After this I get a blank screen and can no longer see my settings.
    No amount of restarting has fixed this. And I cannot see a way to create a device through the client software and add transcode settings.
    Help?
    Thanks in advance,
    Ben

    Ah very good!
    Ok - it seems then that this works absolutely fine as a work around. I can create a device and then assign the device to transcode settings through the client adminsitration panel (which is indeed what I meant).
    So, there is a work around. Far less pressing now, but I would like to know why I'm getting the error message all the same - I'm now concerned about the integrity of the database...
    Thanks Tony!
    B

  • DI 11.5.3 created inactive repository sessions on the database server

    The cusotmer complaint that many inactive sessions have been created on their DI repository database. As a result, the database has to be bounced every 3 or 4 days to clean those sessions. They use DI 11.5.3 on HP-UX. The database is Oracle 10g. What would cause this issue? The improper close of the Desinger window? Or something wrong with the job design?
    Thanks,
    Larry

    what is the process or application to which these sessions belong, Designer is not the only application which will open repo connection. WebAdmin also open connection to repository, it actually opens multiple connection
    I think you can get the application and process which have opened session to the database from v$sessions table

  • Query to find Memory used by each session in the database

    Hi All,
    Is there any query to find the memory utilised by each session in the database.I am in 9i database.
    Regards
    Vijay

    Memory using sessions script,
    SET LINESIZE 145
    SET PAGESIZE 9999
    COLUMN sid FORMAT 99999 HEADING 'SID'
    COLUMN serial_id FORMAT 999999 HEADING 'Serial#'
    COLUMN session_status FORMAT a9 HEADING 'Status' JUSTIFY right
    COLUMN oracle_username FORMAT a12 HEADING 'Oracle User' JUSTIFY right
    COLUMN os_username FORMAT a9 HEADING 'O/S User' JUSTIFY right
    COLUMN os_pid FORMAT 9999999 HEADING 'O/S PID' JUSTIFY right
    COLUMN session_program FORMAT a18 HEADING 'Session Program' TRUNC
    COLUMN session_machine FORMAT a8 HEADING 'Machine' JUSTIFY right TRUNC
    COLUMN session_pga_memory FORMAT 9,999,999,999 HEADING 'PGA Memory'
    COLUMN session_pga_memory_max FORMAT 9,999,999,999 HEADING 'PGA Memory Max'
    COLUMN session_uga_memory FORMAT 9,999,999,999 HEADING 'UGA Memory'
    COLUMN session_uga_memory_max FORMAT 9,999,999,999 HEADING 'UGA Memory MAX'
    prompt
    prompt ----------------------------------------------------
    prompt | User Sessions Ordered by Current PGA Size |
    prompt ----------------------------------------------------
    SELECT
    s.sid sid
    , s.serial# serial_id
    , lpad(s.status,9) session_status
    , lpad(s.username,12) oracle_username
    , lpad(s.osuser,9) os_username
    , lpad(p.spid,7) os_pid
    , s.program session_program
    , lpad(s.machine,8) session_machine
    , sstat1.value session_pga_memory
    , sstat2.value session_pga_memory_max
    , sstat3.value session_uga_memory
    , sstat4.value session_uga_memory_max
    FROM
    v$process p
    , v$session s
    , v$sesstat sstat1
    , v$sesstat sstat2
    , v$sesstat sstat3
    , v$sesstat sstat4
    , v$statname statname1
    , v$statname statname2
    , v$statname statname3
    , v$statname statname4
    WHERE
    p.addr (+) = s.paddr
    AND s.sid = sstat1.sid
    AND s.sid = sstat2.sid
    AND s.sid = sstat3.sid
    AND s.sid = sstat4.sid
    AND statname1.statistic# = sstat1.statistic#
    AND statname2.statistic# = sstat2.statistic#
    AND statname3.statistic# = sstat3.statistic#
    AND statname4.statistic# = sstat4.statistic#
    AND statname1.name = 'session pga memory'
    AND statname2.name = 'session pga memory max'
    AND statname3.name = 'session uga memory'
    AND statname4.name = 'session uga memory max'
    ORDER BY session_pga_memory DESC
    Thanks

  • Saving session state in database table rather in websever for Ordering App

    Hi all,
    Ours is a ordering application (telecomm) domain.
    Currently, we are storing user sessions data (Order shopping cart session data) in middle tier (iPlanet web server) which inturn consumes lot of memory resources.
    Shopping cart could be in MBs if order is a huge business order.
    So in order to not to overtax web server (middle tier), we are thinking of storing session data directly in a database table to relieve the overhead on web server and make use of database for storage.
    I read that APEX (html db) is already using this "single metadata table" approach for session data management. But we are not using HTML DB to really look into.
    Can some one advise how to go about storing "user session data" directly in a "database table" for both storage and retrieval purposes instead of storing it in "webserver".
    How does this "metadata table" structure looks like. Is it more generic ?
    Really appreciate your time and help/suggestions.

    Joel,
    Thanks for your response. sorry, i meant to say that "the current application does not use APEX but will look into it".
    To build this is an utterly non-trivial exercise. Oh - it may not be so hard to save session state to a table when you POST a page. But you may want to reference this in many places, and it's a question of can you change all of these references to indirect references from session state in your application.In order to free up the load on webserver, we want to maintain session management in database. Could you please explain the above little more :
    How do we maintain the "user session" with "database table" ?
    Do we need to store "session data" at java object level or by page in database table ? How does the structure of this "metadata table" looks like.
    Thanks for your time.

  • How to clean the dead sessions in the database?

    Hi,
    sqlldr user/passwd@dbtns DIRECT=TRUE SKIP_UNUSABLE_INDEXES=TRUE SKIP_INDEX_MAINTENANCE=FALSE control="test.ctl"
    3M records
    The OS shutdown when i sqlldr, and start another sqlldr into the same table
    but the table is locked.
    sqlldr failed
    SQL*Loader-951: Error calling once/load initialization
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
    how to use ORACLE system maintenance procedure to clear the database dead session?
    Which procedure?
    I don't want to use the solution:
    alter system kill session

    HI..
    What is the status of the session in V$sesison view.Does the session exist.
    COLUMN username FORMAT A15
    col osuser for a15
    col module for a15
    COLUMN machine FORMAT A30
    col program for a20
    COLUMN logon_time FORMAT A20
    SELECT NVL(s.username, '(oracle)') AS username,
           s.osuser,
           s.sid,
           s.serial#,
           p.spid,
           s.status,
           s.module,
           s.terminal,
           s.machine,
           s.program,
           TO_CHAR(s.logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time
    FROM   v$session s,
           v$process p
    WHERE  s.paddr  = p.addr
    and AND    s.status = 'ACTIVE'
    ORDER BY s.username, s.osuser;Anand

  • Losing connetion pools when killing off sessions on the database

    Hi,
    We are using webLogic version 6.1 as our app. We are currently experiencing a problem with the connection pools to our databases.
    Problem: We have some jobs that run on our databases through connections pools via webLogic. When we kill the session of the job on the database side, all the connections using that connection pool from webLogic to that database is lost. We tried to re-target the connection pool through the console but this fails to work, thus requiring a bounce to the webLogic system.
    Is there an explanation for this, moreover is there a solution to resolve this as this seems unacceptable in a live production situation.
    Thanks and regards
    William Sung
    Coporate Investment Banks & Markets
    44 (0)20 7779 1357

    William Sung wrote:
    Hi,
    We are using webLogic version 6.1 as our app. We are currently experiencing a problem with the connection pools to our databases.
    Problem: We have some jobs that run on our databases through connections pools via webLogic. When we kill the session of the job on the database side, all the connections using that connection pool from webLogic to that database is lost. We tried to re-target the connection pool through the console but this fails to work, thus requiring a bounce to the webLogic system.
    Is there an explanation for this, moreover is there a solution to resolve this as this seems unacceptable in a live production situation.
    Thanks and regards
    William Sung
    Coporate Investment Banks & Markets
    44 (0)20 7779 1357Hi. What DBMS is this, and what JDBC driver are you using? Also, show me the pool
    definition. I may be able to help the situation, but I don't think that killing DBMS sessions
    out from under applications is anything anyone should do in a production system.
    Joe

  • Input the data in to the grid without saving it to the  database

    <PRE lang=jsp id=pre2 style="MARGIN-TOP: 0px" nd="109"><%@ taglib uri="/WEB-INF/tags/datagrid.tld" prefix="grd" %>
    <%@ page import="java.sql.Connection" %>
    <%@ page import="java.sql.DriverManager" %>
    <%@ page import="java.sql.SQLException" %>
    <%@ page import="com.freeware.gridtag.*" %>
    <%
    int intCurr = 1;
    int intSortOrd = 0;
    String strTmp = null;
    String strSQL = null;
    String strSortCol = null;
    String strSortOrd = "ASC";
    boolean blnSortAsc = true;
    strSQL = "SELECT CLICORPORATION, CLICLIENT, CLIDESCRIPTION, " +
    "CLIENABLED, CLIUPDSTAMP FROM CLIENTMASTER ";
    Connection objCnn = null;
    Class objDrvCls = null;
    objDrvCls = Class.forName("oracle.jdbc.driver.OracleDriver");
    objCnn = DriverManager.getConnection("<A class=iAs style="FONT-WEIGHT: normal; FONT-SIZE: 100%; PADDING-BOTTOM: 1px; COLOR: darkgreen; BORDER-BOTTOM: darkgreen 0.07em solid; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" href="#" target=_blank itxtdid="3346226">jdbc</A>:oracle:thin:@Host:port:sid",
    "cashincpri", "cashincpri");
    if (objDrvCls != null) objDrvCls = null;
    strTmp = request.getParameter("txtCurr");
    try
    if (strTmp != null)
    intCurr = Integer.parseInt(strTmp);
    catch (NumberFormatException NFEx)
    strSortCol = request.getParameter("txtSortCol");
    strSortOrd = request.getParameter("txtSortAsc");
    if (strSortCol == null) strSortCol = "CLICLIENT";
    if (strSortOrd == null) strSortOrd = "ASC";
    blnSortAsc = (strSortOrd.equals("ASC"));
    %>
    <html>
    <head>
    <title>Grid Tag Demonstration</title>
    <link REL="StyleSheet" HREF="css/GridStyle.css">
    <script LANGUAGE="javascript">
    function doNavigate(pstrWhere, pintTot)
    var strTmp;
    var intPg;
    strTmp = document.frmMain.txtCurr.value;
    intPg = parseInt(strTmp);
    if (isNaN(intPg)) intPg = 1;
    if ((pstrWhere == 'F' || pstrWhere == 'P') && intPg == 1)
    alert("You are already viewing first page!");
    return;
    else if ((pstrWhere == 'N' || pstrWhere == 'L') && intPg == pintTot)
    alert("You are already viewing last page!");
    return;
    if (pstrWhere == 'F')
    intPg = 1;
    else if (pstrWhere == 'P')
    intPg = intPg - 1;
    else if (pstrWhere == 'N')
    intPg = intPg + 1;
    else if (pstrWhere == 'L')
    intPg = pintTot;
    if (intPg < 1) intPg = 1;
    if (intPg > pintTot) intPg = pintTot;
    document.frmMain.txtCurr.value = intPg;
    document.frmMain.submit();
    function doSort(pstrFld, pstrOrd)
    document.frmMain.txtSortCol.value = pstrFld;
    document.frmMain.txtSortAsc.value = pstrOrd;
    document.frmMain.submit();
    </script>
    </head>
    <body>
    <h2>Grid Example</h2>
    <form NAME="frmMain" METHOD="post">
    <grd:dbgrid id="tblStat" name="tblStat" width="100" pageSize="10"
    currentPage="<%=intCurr%>" border="0" cellSpacing="1" cellPadding="2"
    dataMember="<%=strSQL%>" dataSource="<%=objCnn%>" cssClass="gridTable">
    <grd:gridpager imgFirst="images/First.gif" imgPrevious="images/Previous.gif"
    imgNext="images/Next.gif" imgLast="images/Last.gif"/>
    <grd:gridsorter sortColumn="<%=strSortCol%>" sortAscending="<%=blnSortAsc%>"/>
    <grd:rownumcolumn headerText="#" width="5" HAlign="right"/>
    <grd:imagecolumn headerText="" width="5" HAlign="center"
    imageSrc="images/Edit.gif"
    linkUrl="javascript:doEdit('{CLICORPORATION}', '{CLICLIENT}')"
    imageBorder="0" imageWidth="16" imageHeight="16"
    alterText="Click to edit"/>
    <grd:textcolumn dataField="CLICLIENT" headerText="Client"
    width="10" sortable="true"/>
    <grd:textcolumn dataField="CLIDESCRIPTION" headerText="Description"
    width="50" sortable="true"/>
    <grd:decodecolumn dataField="CLIENABLED" headerText="Enabled" width="10"
    decodeValues="Y,N" displayValues="Yes,No" valueSeperator=","/>
    <grd:datecolumn dataField="CLIUPDSTAMP" headerText="Last Updated"
    dataFormat="dd/MM/yyyy HH:mm:ss" width="20"/>
    </grd:dbgrid>
    <input TYPE="hidden" NAME="txtCurr" VALUE="<%=intCurr%>">
    <input TYPE="hidden" NAME="txtSortCol" VALUE="<%=strSortCol%>">
    <input TYPE="hidden" NAME="txtSortAsc" VALUE="<%=strSortOrd%>">
    </form>
    </body>
    </html>
    <%
    try
    if (objCnn != null)
    objCnn.close();
    catch (SQLException SQLExIgnore)
    if (objCnn != null) objCnn = null;
    %>
    </PRE>
    by using this code we will get the gide.
    but the problem is when we are inserting the new record after click to save the record first saves the data in the Db and then it appears on the grid.
    Is it possible to do reverse of the above :
    first it comes to the grid and then after click to save it save to the database.
    please help me
    Regards,
    imran

    Hi Yamini,
    What do you mean by without query region here? Do you wish to implement the complete search/result functionality without using the Query page? Or your question already answered. Kindly confirm.
    Regards
    Sumit

  • Saving forms in the database

    Is it possible to save an Oracle Form in the database? I have some forms thah require checking to see if they access various tables. I'd like to load the forms into the database and query the forms metadata, but not being a forms person I'm not sure if this is possible.
    Any information would be helpful.
    Many Thanks
    Paddy

    Version? (http://blogs.oracle.com/shay/2007/03/02)
    This is an article from Metalink:
    Subject: Oracle Forms in Applications FAQ
    Doc ID: Note:177610.1 Type: FAQ
    Last Revision Date: 28-FEB-2006 Status: PUBLISHED
    Can you save Form modules (FMB, MMB, PLL) into the database?
    Yes and no. Yes if its standalone and no if its part of Apps, this is because Apps forms are structured so that their dependent modules are all stored as files. In Forms 9i (not yet released) you will not be able to store Forms modules in the database altogether.

  • Saving dates in the database

    How do I save a date in the database?
    My code is as follows:
    int year = 2002;
    int month = 2;
    int day = 3;
    java.util.Date sdate = new java.util.Date(year, month, day);
    PreparedStatement ps = "INSERT INTO period_table(pe_start) VALUES (?)";
    ps.setDate(1, sdate);
    ps.executeUpdate();

    To insert a Date into a database the best way is to use
    the java.sql.Date object instead of the java.util.Date
    int year = 2002;
    int month = 2;
    int day = 3;
    java.util.Date sdate = new java.util.Date(year, month, day);
    java.sql.Date sqldate = new java.sql.Date(sdate.getTime());
    Write the sqldate variable into the database.

  • Saving documents in the Database

    Does anybody know if it is possible to drag and drop a document into a Form and then save it to the database?
    If you do then can you tell me how?
    Thanks
    Trudy

    To insert a Date into a database the best way is to use
    the java.sql.Date object instead of the java.util.Date
    int year = 2002;
    int month = 2;
    int day = 3;
    java.util.Date sdate = new java.util.Date(year, month, day);
    java.sql.Date sqldate = new java.sql.Date(sdate.getTime());
    Write the sqldate variable into the database.

  • Max number of sessions in the database for abt a month

    Hi,
    We are adding around 1000 additional users to our 11g database, how to find the impact of CPU, Memory etc.. And also we would like to know max number of sessions in last one month. Please let us know how to get this info.
    Thanks in advance.
    Edited by: 934825 on Dec 7, 2012 7:55 AM

    vlethakula wrote:
    You can join
    dba_hist_resource_limit and dba_hist_snapshot
    SELECT a.begin_interval_time, a.end_interval_time,
    b.resource_name, b.current_utilization,
    b.max_utilization
    FROM dba_hist_resource_limit b, dba_hist_snapshot a
    WHERE a.snap_id = b.snap_id AND b.resource_name = 'sessions'
    ORDER BY a.begin_interval_timeDon't forget that the use of these DBA_HIST* views or their underlying tables requires a license for the performance pack.

  • Capture Web Cam image in APEX and Upload into the Database

    Overview
    By using a flash object, you should be able to interface with a usb web cam connected to the client machine. Their are a couple of open source ones that I know about, but the one I chose to go with is by Taboca Labs and is called CamCanvas. This is released under the MIT license, and it is at version 0.2, so not very mature - but in saying that it seems to do the trick. The next part is to upload a snapshot into the database - in this particular implementation, it is achieved by taking a snapshot, and putting that data into the canvas object. This is a new HTML5 element, so I am not certain what the IE support would be like. Once you have the image into the canvas, you can then use the provided function convertToDataURL() to convert the image into a Base64 encoded string, which you can then use to convert into to a BLOB. There is however one problem with the Base64 string - APEX has a limitation of 32k for and item value, so can't be submitted by normal means, and a workaround (AJAX) has to be implemented.
    Part 1. Capturing the Image from the Flash Object into the Canvas element
    Set up the Page
    Required Files
    Download the tarball of the webcam library from: https://github.com/taboca/CamCanvas-API-/tarball/master
    Upload the necessary components to your application. (The flash swf file can be got from one of the samples in the Samples folder. In the root of the tarball, there is actually a swf file, but this seems to be a different file than of what is in the samples - so I just stick with the one from the samples)
    Page Body
    Create a HTML region, and add the following:
        <div class="container">
           <object  id="iembedflash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="240">
                <param name="movie" value="#APP_IMAGES#camcanvas.swf" />
                <param name="quality" value="high" />
              <param name="allowScriptAccess" value="always" />
                <embed  allowScriptAccess="always"  id="embedflash" src="#APP_IMAGES#camcanvas.swf" quality="high" width="320" height="240"
    type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" mayscript="true"  />
        </object>
        </div>
    <p><a href="javascript:captureToCanvas()">Capture</a></p>
    <canvas style="border:1px solid yellow"  id="canvas" width="320" height="240"></canvas>That will create the webcam container, and an empty canvas element for the captured image to go into.
    Also, have a hidden unprotected page item to store the Base64 code into - I called mine P2_IMAGE_BASE64
    HTML Header and Body Attribute
    Add the Page HTML Body Attribute as:
    onload="init(320,240)"
    JavaScript
    Add the following in the Function and Global Variable Declarations for the page (mostly taken out of the samples provided)
    //Camera relations functions
    var gCtx = null;
    var gCanvas = null;
    var imageData = null;
    var ii=0;
    var jj=0;
    var c=0;
    function init(ww,hh){
         gCanvas = document.getElementById("canvas");
         var w = ww;
         var h = hh;
         gCanvas.style.width = w + "px";
         gCanvas.style.height = h + "px";
         gCanvas.width = w;
         gCanvas.height = h;
         gCtx = gCanvas.getContext("2d");
         gCtx.clearRect(0, 0, w, h);
         imageData = gCtx.getImageData( 0,0,320,240);
    function passLine(stringPixels) {
         //a = (intVal >> 24) & 0xff;
         var coll = stringPixels.split("-");
         for(var i=0;i<320;i++) {
              var intVal = parseInt(coll);
              r = (intVal >> 16) & 0xff;
              g = (intVal >> 8) & 0xff;
              b = (intVal ) & 0xff;
              imageData.data[c+0]=r;
              imageData.data[c+1]=g;
              imageData.data[c+2]=b;
              imageData.data[c+3]=255;
              c+=4;
         if(c>=320*240*4) {
              c=0;
              gCtx.putImageData(imageData, 0,0);
    function captureToCanvas() {
         flash = document.getElementById("embedflash");
         flash.ccCapture();
         var canvEle = document.getElementById('canvas');
         $s('P2_IMAGE_BASE64', canvEle.toDataURL());//Assumes hidden item name is P2_IMAGE_BASE64
         clob_Submit();//this is a part of part (AJAX submit value to a collection) two
    }In the footer region of the page (which is just a loading image to show whilst the data is being submitted to the collection [hidden by default]) :<img src="#IMAGE_PREFIX#processing3.gif" id="AjaxLoading"
    style="display:none;position:absolute;left:45%;top:45%;padding:10px;border:2px solid black;background:#FFF;" />If you give it a quick test, you should be able to see the webcam feed and capture it into the canvas element by clicking the capture link, in between the two elements - it might through a JS error since the clob_Submit() function does not exist yet.
    *Part 2. Upload the image into the Database*
    As mentioned in the overview, the main limitation is that APEX can't submit values larger than 32k, which I hope the APEX development team will be fixing this limitation in a future release, the workaround isn't really good from a maintainability perspective.
    In the sample applications, there is one that demonstrates saving values to the database that are over 32k, which uses an AJAX technique: see http://www.oracle.com/technetwork/developer-tools/apex/application-express/packaged-apps-090453.html#LARGE.
    *Required Files*
    From the sample application, there is a script you need to upload, and reference in your page. So you can either install the sample application I linked to, or grab the script from the demonstration I have provided - its called apex_save_large.js.
    *Create a New Page*
    Create a page to Post the large value to (I created mine as 1000), and create the following process, with the condition that Request = SAVE. (All this is in the sample application for saving large values).declare
         l_code clob := empty_clob;
    begin
         dbms_lob.createtemporary( l_code, false, dbms_lob.SESSION );
         for i in 1..wwv_flow.g_f01.count loop
              dbms_lob.writeappend(l_code,length(wwv_flow.g_f01(i)),wwv_flow.g_f01(i));
         end loop;
         apex_collection.create_or_truncate_collection(p_collection_name => wc_pkg_globals.g_base64_collection);
         apex_collection.add_member(p_collection_name => wc_pkg_globals.g_base64_collection,p_clob001 => l_code);
         htmldb_application.g_unrecoverable_error := TRUE;
    end;I also created a package for storing the collection name, which is referred to in the process, for the collection name:create or replace
    package
    wc_pkg_globals
    as
    g_base64_collection constant varchar2(40) := 'BASE64_IMAGE';
    end wc_pkg_globals;That is all that needs to be done for page 1000. You don't use this for anything else, *so go back to edit the camera page*.
    *Modify the Function and Global Variable Declarations* (to be able to submit large values.)
    The below again assumes the item that you want to submit has an item name of 'P2_IMAGE_BASE64', the condition of the process on the POST page is request = SAVE, and the post page is page 1000. This has been taken srtaight from the sample application for saving large values.//32K Limit workaround functions
    function clob_Submit(){
              $x_Show('AjaxLoading')
              $a_PostClob('P2_IMAGE_BASE64','SAVE','1000',clob_SubmitReturn);
    function clob_SubmitReturn(){
              if(p.readyState == 4){
                             $x_Hide('AjaxLoading');
                             $x('P2_IMAGE_BASE64').value = '';
              }else{return false;}
    function doSubmit(r){
    $x('P2_IMAGE_BASE64').value = ''
         flowSelectAll();
         document.wwv_flow.p_request.value = r;
         document.wwv_flow.submit();
    }Also, reference the script that the above code makes use of, in the page header<script type="text/javascript" src="#WORKSPACE_IMAGES#apex_save_large.js"></script>Assuming the script is located in workspace images, and not associated to a specific app. Other wise reference #APP_IMAGES#
    *Set up the table to store the images*CREATE TABLE "WC_SNAPSHOT"
    "WC_SNAPSHOT_ID" NUMBER NOT NULL ENABLE,
    "BINARY" BLOB,
    CONSTRAINT "WC_SNAPSHOT_PK" PRIMARY KEY ("WC_SNAPSHOT_ID")
    create sequence seq_wc_snapshot start with 1 increment by 1;
    CREATE OR REPLACE TRIGGER "BI_WC_SNAPSHOT" BEFORE
    INSERT ON WC_SNAPSHOT FOR EACH ROW BEGIN
    SELECT seq_wc_snapshot.nextval INTO :NEW.wc_snapshot_id FROM dual;
    END;
    Then finally, create a page process to save the image:declare
    v_image_input CLOB;
    v_image_output BLOB;
    v_buffer NUMBER := 64;
    v_start_index NUMBER := 1;
    v_raw_temp raw(64);
    begin
    --discard the bit of the string we dont need
    select substr(clob001, instr(clob001, ',')+1, length(clob001)) into v_image_input
    from apex_collections
    where collection_name = wc_pkg_globals.g_base64_collection;
    dbms_lob.createtemporary(v_image_output, true);
    for i in 1..ceil(dbms_lob.getlength(v_image_input)/v_buffer) loop
    v_raw_temp := utl_encode.base64_decode(utl_raw.cast_to_raw(dbms_lob.substr(v_image_input, v_buffer, v_start_index)));
    dbms_lob.writeappend(v_image_output, utl_raw.length(v_raw_temp),v_raw_temp);
    v_start_index := v_start_index + v_buffer;
    end loop;
    insert into WC_SNAPSHOT (binary) values (v_image_output); commit;
    end;Create a save button - add some sort of validation to make sure the hidden item has a value (i.e. image has been captured). Make the above conditional for request = button name so it only runs when you click Save (you probably want to disable this button until the data has been completely submitted to the collection - I haven't done this in the demonstration).
    Voila, you should have now be able to capture the image from a webcam. Take a look at the samples from the CamCanvas API for extra effects if you wanted to do something special.
    And of course, all the above assumed you want a resolution of 320 x 240 for the image.
    Disclaimer: At time of writing, this worked with a logitech something or rather webcam, and is completely untested on IE.
    Check out a demo: http://apex.oracle.com/pls/apex/f?p=trents_demos:webcam_i (my image is a bit blocky, but i think its just my webcam. I've seen others that are much more crisp using this) Also, just be sure to wait for the progress bar to dissappear before clicking Save.
    Feedback welcomed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hmm, maybe for some reason you aren't getting the base64 version of the saved image? Is the collection getting the full base64 string? Seems like its not getting any if its no data found.
    The javascript console is your friend.
    Also, in the example i used an extra page, from what one of the examples on apex packages apps had. But since then, I found this post by Carl: http://carlback.blogspot.com/2008/04/new-stuff-4-over-head-with-clob.html - I would use this technique for submitting the clob, over what I have done - as its less hacky. Just sayin.

  • Data type for Saving Image in SQL database

    Hi,
        Which is the best way for saving images in the database? Filestream or Varbinary(max)?. Will the Varbinary max comsume much space or it will only take the actual size of the data?

    I've used FILETABLE for storing images in SQL 2012
    You can configure it to have transact and non transact access if you want
    see
    http://visakhm.blogspot.in/2012/07/working-with-filetables-in-sql-2012.html
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Could the Database Trigger get a forms variable value

    Hi All
    We have an ERP which connect all users of the system with a single schema (Database user name), We create a record for each user in the ERP itself to specify the privillages for each user
    I would like to make a database trigger to Audit a table , by storing the user name, action (Insert,delete,update) on an audit table.
    The problem is the user name i want to store is not the schema name, but it's stored in a database table and read in a global variable.
    Can i get the user name (which stored in the global variable) in the database trigger ???
    Thanks
    Mostafa Abolaynain

    If this global variable lives inside Forms (which the title of your post seems to indicate), then no.
    A database trigger can only reference "stuff" that lives inside the database session at the database server, not "stuff" that lives inside the proces at the client device.
    You should ask your ERP vendor: there might very well be something (eg. a variable inside a database package) that you can use.

Maybe you are looking for

  • How to load SQL scripts from a text file.

    Hi, i tried several time to load a text file/SQL script with 10 different tables and data, but 10g Express doesen't allows me to do that, any one can direct me or point out to me what i should do or do i need to adopt any special method to to get thi

  • Notes or patch for Import/STO pricing Procedure.

    Hi All.. I want to copy Import -JIMPORT and STO pricing procedure. I am having RM0000 only. I am in ECC6 but its not there.Can you pls tell me the patch or notes that i have to apply to get the Import pricing procedures. Earliest help will be useful.

  • How to remove adds?

    Hello, So I recently installed skype and I came across an ad. It was in the right middle and above and below the ad was a white background. How can I get rid of this?

  • Eepc 901 Archlinux with Kdemon and kdm Login Manager

    Hello, 1.) I have a minimal defect or cosmetic effect on the kdm login system. When I start kdm, I get on left and on the right side of the screen a nasty bar. Nasty Bar means it looks like a piece of the background with nasty colours.....(left side.

  • Connecting several SG300 for failsafe

    Not quite sure what will be best practise for me here: 3 x SG300-28 1 x SG300-10MP Placed in 3 locations 1: 1 x SG300-28 2: 2 x SG300-28 3: 1 x SG300-10MP I have 4 lines between locations 1 and 2, and 2 lines between locations 2 and 3 My idear was to