Attaching to a session using APEX_PLSQL_JOB

Hi All,
I'm going bonkers as I can't see why something isn't working! Basically, I have a process that is started by the user from a page within my application. This process can take a while (a number of minutes) and causes the browser to timeout thinking that the session has died (at least I think that is what is happening). So to work around this I want to submit a job via APEX_PLSQL_JOB and then have the page check every X seconds to see if that job has completed.
The process makes use of collections to temporarily store the output during computation. So to enable this I need to attach to a session and thought I might as well use the submitting users session. Trouble is I get an error at the session attach stage and can't quite work out why exactly. So first up my 'session attach' procedure (which is in a package) is as below:
PROCEDURE sessionattach(
   p_user       VARCHAR2
, p_session    VARCHAR2
, p_app_id     VARCHAR2
, p_page_id    VARCHAR2)
IS
BEGIN
   -- Session attach.
   APEX_CUSTOM_AUTH.define_user_session(p_user, p_session);
   APEX_APPLICATION.g_flow_id := p_app_id;
   APEX_CUSTOM_AUTH.post_login(p_user, p_session, p_app_id || ':' || p_page_id);
END sessionattach;When I create the job I know that the following is being passed in (it's not doing the actual work as I can't get past this stage):
BEGIN
   master_data_pkg.sessionattach(p_user => 'MYUSERNAME', p_session => '4260523061121888', p_app_id => '101', p_page_id => '527');
END;Again I know that each of the parameters is correct as I'm logging the job SQL that is produced. The error stack that is produced is:
ORA-06512: at "SYS.OWA_UTIL", line 354
ORA-06512: at "SYS.HTP", line 1368
ORA-06512: at "SYS.HTP", line 1443
ORA-06512: at "SYS.HTP", line 1735
ORA-06512: at "FLOWS_030100.WWV_FLOW_CUSTOM_AUTH_STD", line 1075
ORA-06512: at "FLOWS_030100.WWV_FLOW_CUSTOM_AUTH_STD", line 662
ORA-06512: at "FLOWS_030100.HTMLDB_CUSTOM_AUTH", line 238
ORA-06512: at "APEXUSR.MASTER_DATA_PKG", line 2114
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 354
ORA-06512: at "SYS.HTP", line 1368
ORA-06512: at "SYS.HTP", line 1443
ORA-06512: at "SYS.HTP", line 1735
ORA-06512: at "FLOWS_030100.WWV_FLOW_CUSTOM_AUTH_STD", line 1075
ORA-06502: PL/SQL: numeric or value errorNow the bit where I get really stuck is if I try and run the session attach from a SQL Developer session, the first time it runs it comes up with the same error stack, but if I run it again I get no error. However, I am still not attached to the session as, if I try and create a collection, I get an ORA-20104/ORA-20001 Invalid parsing schema error.
Any suggestions as to where I'm going wrong and what mistake I am making?
Many thanks,
Gareth.

Ok, I finally resolved the issue by basically using Scotts method in the last post of Re: How to create an Apex 3.1 a session context programmatically? thread.
The only real change I made was to not bother with the setting of a page variable (I assumed this was just to test) and instead of setting apex_application.g_instance to the next session ID I used the one provided by the users session that launched the job.
This allows me to create and, if required, query collections from that users session.
I hope that helps someone else.
Regards,
Gareth.

Similar Messages

  • Problem in tracing session using ORADEBUG utility?

    I want to trace a session using oradebug utility.what i have done is
    SQL>oradebug setospid 25807
    SQL> oradebug set ospid 27441
    unknown command beginning "oradebug s..." - rest of line ignored.
    How i can race another session using oradebug utility.
    Thank you...

    The correct syntax is
    oradebug setospid <Unix pid>
    You can 'attach' to one process only.
    You have two oradebug setospid commands issued, the latter one is wrong, but wouldn't have worked anyway.
    The usual method to trace a session is
    oradebug setospid ...
    oradebug event 10046 trace name context forever, level 12
    This should work.
    Note you can accomplish the same using dbms_system.set_ev
    Sybrand Bakker
    Senior Oracle DBA

  • How do I get at Session using Context's

    Hi,
    Please can someone help me out. I am working on an extended version of the jboss DatabaseServerLoginModule and part of this involves overidding the login() method. The login() method provides no parameters such as request etc and so I have no way of getting at the session.
    How can I get at the session using Context's?
    i.e. starting with say InitialContext and going from there....
    any ideas?
    Regards,
    Paul.

    Sounds like a JBoss question to me. Seems to me that JBoss support would be the place to go for answers. It's really not a general Java programming question.

  • How to set a variable in portal session using web dynpro java.

    Hi,
    I have created a web dynpro application, which is running inside portal. I have created a role called "R1". Inside role R1, i have created 3 workset W1, W2 and W3. and inside each workset i have some pages and iviews.
    My requirement is when user logins to the portal , and when he clicks on role R1 for the first time, a login page should come (so that we can do revalidation), and when he enters his password again in that login page , then only workset W1, W2 and W3 should be visible/accessible to him and after successful revalidation, if he clicks again on role R1, in that particular portal session, than that login page should not come.
    for this, i thought i will set a variable in portal session, whenever user successfully revalidated himself, and if after successful revalidation he clicks again on role R1, i will check in doinit method of webdynpro whether variable is set or not (which i already set on successful revalidation), and if it is set then i will do Donavigation else i will present login page to the user.
    Can anyone tells me how to set a variable in portal session using web dynpro java.
    thanks
    Arush

    Hi,
    Try this:
    WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE, key, value)
    WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE, key)
    Ex:
    WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE,"Key1","Value1");
    String value1=WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE,"Key1").toString();
    /people/william.cui/blog/2007/02/12/sharing-session-context-between-parent-and-external-windows-running-on-same-host
    Regards,
    Charan

  • Sending attachment in a mail using SO_DOCUMENT_SEND_API1

    Hi,
    I am trying to send an attachment in a mail using the FM SO_DOCUMENT_SEND_API1.
    The contents of the body and the attachement are same.
    The contents of the body are coming in proper format but the attachements are not.
    The body contents are in this way:
    1000013559     0010004994     PBG BROOKF     1000013559     000100     010052000328667000     GA LQ CRE 20OZ 24CS FRT PUN              0.000     CS
    1000013559     0010004994     PBG BROOKF     1000013559     000200     010052000328681000     GA LQ CRE 20OZ 24CS LL              0.000     CS
    But the attachement contents are:
    1000013559     0010004994     PBG BROOKF     1000013559     000100     010052000328667000     GA LQ CRE 20OZ 24CS FRT PUN
             ⸀        䌀匀ഀ਀                                                                                                         u2020
    1000013559     0010004994     PBG BROOKF     1000013559     000200     010052000328681000     GA LQ CRE 20OZ 24CS LL
        ⸀        䌀匀ഀ਀                                                                                                              u2020
    Also the last 2 fields which are quantity and unit fields, are not coming at all in the attachment.
    Please help me solve this issue.
    Thanks,
    Abhishek

    what is the document type of attachment? is it excel?

  • How to Ftp a Blob attachment in a table using osb service

    How to Ftp a Blob attachment in a table using osb service
    I tried with DBadapter select it does not work ... For blob objects cant use select throws error as expected number got blob
    can call a stored procedure to write the file to some directory but that file will not be created with the same name of the file as stored in DB .. need to hard code the filename in utl file or if we pass a variable to get the name of the attachment file we have to use select query in cursor which throws error like above in step 2
    Can some body tell me how to get the blob attachment with the same name as it is stored in DB table
    Edited by: user13745573 on Jan 31, 2011 4:35 AM

    Hi,
    I want to send an attachment through email.
    But I want to pick the file from say local drive then how can i specify the path of the file in file name.
    Also, i dont want ot append the conent from payload to the file. i wanted to sendthe file as is.
    <ema:attachment>
    <ema:name></ema:name>
    <ema:type>text/plain</ema:type>
    <ema:content/>
    </ema:attachment>
    Please help.

  • Session using db link?

    Some of the Users are connecting to my database through database links.
    How to know the user session is using db link?
    Is there any view, which shows connected dblink's ?

    Even v$session would show this, but indirectly.
    Whenever any query is given through a dblink, it automatically starts a transaction, so connecting this with v$transaction with username, you can find the transaction and from there get through v$sqlarea or v$sql to find the sql with dblink. Though its a round about way, it is possible to find session using dblinks, thats is my point. pls try it and let us know.
    Siva

  • How can I enable session(using url)  tracking in home page

    i am developing bidding application. How can I enable session(using url) tracking in home page ?
    for example :
    http://mydomine.com/index.jsp;jsessionid=4A38A4496F6862681DFD09CD6D648485.tomcat75
    please help me.

    Doubleposted. Please continue here: [http://forum.java.sun.com/thread.jspa?threadID=5308686&tstart=0]
    In the future, do not use the back button to edit the message, but use the edit button instead. Otherwise you're reposting the form again. You should know that better as being a web developer.

  • Recently, I have not been able to attach files to emails using the MobileMe webmail system.

    When trying to attach files to emails using the MobileMe webmail system, it lets me browse and click on a file but then does nothing and there is no actual attachment. It previously always worked. I checked with the MobileMe folks and they said it is a browser problem. (True, it works in Safari.) Any ideas on how to fix this? I prefer Firefox, of course.

    Hi davebundy-
    One suggestion I've heard is that ad block may be perceiving the mail client as an advertisement. The solution was to mark the webmail URL as safe with any ad block plugins or software you have. Hope that helps.

  • Export dumps failing with ORA-31623: a job is not attached to this session

    Hi,
    Oracle Version : 11.1.0.7.0
    OS Solaris : 10
    Export partition dumps failing with the Error message ORA-31623: a job is not attached to this session via the specified handle.
    When i checked the table dba_datapump_jobs, i found several table is in "NOT RUNNING" status. Please help me what to do this?
    OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS
    OAM BIN$wzWztSbKbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSbZbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztScGbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSaxbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSbAbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSbPbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSbobFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSb3bFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSanbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSb8bFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSa2bFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS
    OAM BIN$wzWztSbtbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSbFbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSbybFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztScLbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSasbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSbUbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztScBbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSa7bFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSbebFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    OAM BIN$wzWztSbjbFjgRAAUT9ZhNg==$0 EXPORT TABLE NOT RUNNING 0 0 0
    21 rows selected
    Regards,
    Deeban

    Hi,
    I read this is some site to stop or kill the data pump jobs. But i wants to know anyone tried this and whether this is recommendable to do or not?
    we can now stop and kill the job:
    SET serveroutput on
    SET lines 100
    DECLARE
    h1 NUMBER;
    BEGIN
    -- Format: DBMS_DATAPUMP.ATTACH('[job_name]','[owner_name]');
    h1 := DBMS_DATAPUMP.ATTACH('SYS_IMPORT_SCHEMA_01','SCHEMA_USER');
    DBMS_DATAPUMP.STOP_JOB (h1,1,0);
    END;
    Regards,
    Deeban

  • Flex session using blazeds?

    Hello,
    Need help on managing the Flex session using blazeds. If source is available, it would help a lot.

    Hi saisri2k2,
    Instead of making use of Server side session you can make a logic of your own at the client side itself by making use of the FlexEvent.IDLE and doing the appropriate action accordingly.
    You can google for the FlexEvent.IDLE  keyword. So if the user stays idle for a particular time you can register a check in the eventListener registerd for FlexEvent.IDLE and navigate or redirect user to another page.
    Thanks,
    Bhasker

  • I can't attach files in gmail using firefox

    <i>Locking duplicate thread.<br>Please continue here: [[/questions/1014563]]</i>
    Greetings,
    Starting today I'm unable to attach files to emails using my gmail account, when opening in firefox. I'm using the latest version of firefox (31.0) and have been using it fine for a couple of months. I click on the attachment button, and the search browser does not open. Email attachments work fine using safari.
    I've uninstalling and reinstalling firefox, I've cleared my history, cookies and cache. I've turned my computer off and back on.
    Please help, thank you.
    Shea

    If you can't add attachments to Gmail messages then you need to add an allow exception to allow pop-ups for the Google website.
    Easiest to do this is to click the padlock on the location bar and click the "More Information" button to open the "Tools > Page Info" window with the Security tab selected.
    Proceed to the Permissions tab
    Remove the tick on "Open Pop-up Windows" > "Use Default" and click the Allow radio button to change the permission to allow pop-ups for this domain.
    Google is looking into this issue, see:
    * https://productforums.google.com/forum/#!topic/gmail/q0BxcGOa6pk

  • Setting and retrieving session using pl/sql

    How to set and retrieve session using pl/sql?Can anyone help me?

    mrs wrote:
    create or replace
    function get_login_details(in_user in VARCHAR2,in_pwd in VARCHAR2,in_cname in VARCHAR2)
    ..snipped..The code should look as follows:
    create or replace function AuthenticateUser( userName varchar2, userPassw varchar2, userGroup varchar2 )
    return integer is
      i integer;
    begin
      --// purpose of the SQL is simply to check if such a row exist -
    --// no data from the row needs to be fetched
      select 1 into i from acl_users_gv
      where user_name = userName
      and password = userPassw
      and entity_group_name = userGroup;
      --// if the SQL succeeded, then the row exists and matches
      --// the authentication details
      return( 0 );
    exception when NO_DATA_FOUND then
      --// SQL failed to find a row - authentication details do
      --// not exist
      return( 1 );
    end;No need to fetch data unnecessarily. No need too check the fetched data when the column values are already checked via the SQL filter condition (predicate).
    No need to return a flag variable as a freely formatted text string containing Successful Login and login failed. That is not a robust design to use a string variable like that. Use boolean for true/false. Or use integer values 0/1.
    This is my function get_login_details.And I need to get this 'o_mesg' in other java file also.Standard PL/SQL call from Java. The SQL string to execute contains an anonymous PL/SQL and needs to use bind variables. E.g.
    begin
      :result := AuthenticateUse( :userName, :userPassw, :userGroup );
    end;
    Can you suggest the right way, how I can get this variable in other pages?That depends on whether there is database session state. If there is, authentication can be done once only via a trusted context, that specifies whether the session is authenticated.
    If this is done from an app server that uses a db session pool and stateless db sessions, the state needs to be kept in the app server.
    Do you understand what stateful versus stateless db sessions are, and what the differences are?

  • Setting session using pl/sql

    How to set and retrieve session using pl/sql?Can anyone help me?

    This is the wrong forum for SQL or PL/SQL questions.
    1. Post your question in the SQL and PL/SQL forum
    https://forums.oracle.com/forums/forum.jspa;jsessionid=8d92100c30d7960321c250bf4adeaa5dcac037eb147c.e34SbxmSbNyKai0Lc3mPbhmSbNaLe0?forumID=75&start=0
    2. Edit this thread and post the link to your new question.
    3. Mark this thread ANSWERED so people will follow up in the other forum.
    When you post your new question provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION). You will also need to explain what you mean by 'set and retrieve' session. A session is created when a logon is successful so 'set' and 'retrieve' only have meaning in terms of trying to set or retrieve session parameters that may be in effect.

  • How to store php sessions using memcached and unix socket

    I am running Arch linux with systemd, nginx, and php with php-fpm. I am trying (and failing) to configure memcached to store sessions using a unix socket. I have memcached installed and active, however, I am unable to disable networking. I added the following line to /etc/conf.d/memcached
    MEMCACHED_ARGS="-s unix:///tmp/memcached.sock -a 666"
    I also tried:
    MEMCACHED_ARGS="-s /tmp/memcached.sock -a 666"
    MEMCACHED_ARGS="-s unix:/tmp/memcached.sock -a 666"
    when I restart memcached I always get:
    memcached.service - Memcached Daemon
              Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled)
              Active: active (running) since Sat 2013-01-19 17:41:15 PST; 5min ago
            Main PID: 773 (memcached)
              CGroup: name=systemd:/system/memcached.service
                      └─773 /usr/bin/memcached -l 127.0.0.1
    when I run php script with sessions php error log shows (not surprisingly):
    [19-Jan-2013 16:46:45 America/Los_Angeles] PHP Warning:  Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (unix:/tmp/memcached.sock) in Unknown on line 0
    I also installed the php-memcached package but I don't what it does or how to get it going. I uncommented the following line in /etc/php/conf.d/memcached.ini:
    extension=memcached.so
    but that didn't change anything.
    Any insights or suggestions would be greatly appreciated.

    Look at this link -http://odiexperts.com/getting-one-or-several-unknown-files-from-a-directory
    change the command to fetch the ls command and write into File and then using either java or jython break the data and fetch the file name and date and insert into log table.
    (or)
    you can use the os.system command and get the complete ls command into string and then process and insert it.
    Let us know if you need any other help.

Maybe you are looking for

  • Odd Windows/iTune Behavior

    Help!!!! When I plug my newly purchased 60GB ipod into both my XP SP2 laptop and dekstop my computer erradically freezes and itunes freezes. I checked the event logs and I notices this message. Event Type: Warning Event Source: PlugPlayManager Event

  • Print options epson 3880 and CS5

    I cannot set the paper type or size on my Epson Stylus Pro 3880 from my CS5 print menu on my Mac OS10.6.3OS. I have reinstalled and gotten updates ... controls are absent? Anyone?

  • How to update task status from custom task in state machine workflow

    i m using custom task for state machine workflow i am using if(this.onTaskChangedSupervisorAction_AfterProperties.ExtendedProperties["Workflowstatus"].ToString().Contains("Approved")) if above is true moving forward its working fine but i want to upd

  • Cómo actualizo mi SO X10.4.11 a So X10.6 o más?

    Tengo una iMac PowerPC G5 1.9Ghz, con 1.5GB de SDRAM DDR2 con un disco duro de 160GB Necesito actualizar el Mac OS X 10.4.11 a uno mejor que me permita bajar aplicaciones como el google chrome y otras cosas, ya que practicamente no me deja hacer nada

  • What to use iPod Touch For?

    I'm getting a free iPod Touch. What can I use it for?