Apex architecture

Client needs data accessed and pulled from multiple MS access databases and then build Apex apps based on it. Suggestion was to write a web service and pull data from MS access DB to sql sever and build app from there.
Any thoughts as far as how to approach this?
Thank you
Saki
Edited by: user10690319 on Feb 11, 2009 12:45 PM

Apex NEEDS an Oracle database to work in, so having data in an Access or SQL Server database is a wasted effort.. Why not move the data out of those two clunkers and into a REAL database like Oracle??
Thank you,
Tony Miller
Webster, TX

Similar Messages

  • Where can I learn about RAC with APEX .... or APEX architecture?

    Hi All,
    We are desiring to use RAC w/10g and run several APEX applications.
    RAC runs different instances of the same Database so I need to know if there would be a problem with the session information.
    Thank you, BillC

    Bill,
    I believe that the reason you don't see much on this topic is because it is very architecturally simple. For me, at least, this is a good thing. You can contact me here:
    http://concept2completion.net/c2/f?p=9876:20
    if you want some details, but I think what you are looking for can be summed up fairly simply.
    First, let's assume now Webcache because I think Webcache is very unusual for an Apex application.
    You don't need to cluster any of the mid-tier components. Just put a load balancer in front of your App Servers. You will get a slight improvement if you have the load balancer perform a sticky session (that is, it will route the same user to the same App Server for subsequent requests). The reason for this is that if the user is routed to the same App Server it is likely to get the same database session it had previously, and will likely be on the same RAC node.
    Configure your Apex DADs (typically one per App Server) to utilize as many RAC nodes as you like. Generally this would be all of your RAC nodes, but that is not necessary. Your DBA will probably know how to do this for the effect you want (balancing, failover, etc.).
    So, what happens through a request. This is dependent a little on if you let the Apex engine handle session mgt. Generally you do, so we will assume that Apex is setting a cookie and handling the checks. My order might be slightly off... The "Apex Engine" refers to activities that Apex does inside the database.
    1. The user requests a page.
    2. The App Server passes the request along with any cookie information, header info, etc. to mod_plsql, which has a session pool connected to the database instance(s).
    2a. I'm not 100% sure on this, but I believe that if the user has already used a session from that session pool, mod_plsql will try to reuse that same session which is already connected to a database instance. I think this will cause the user to be connected to the same instance that he was in previously (if this is not the first call).
    3. The Apex engine (inside the database) checks for the existence of a cookie and a session id that match a record in the session table.
    3a. If no match is found it will create a record and set the cookie and session id in your browser.
    4. The Apex engine sets up environment variables (nls_lang, apex_user, etc.) and accesses any user session info (in a session info table)
    5a. If a submit, the Apex engine processes the page and, via the App Server, returns a page moved response indicating what page for the browser to branch to (see 5b)
    5b. If a get, the Apex engine creates a page within the db and passes the generated html back through the App Server to the browser.
    As you can see, the App Server does not do much. It is just a conduit between the browser and the database.
    If you want to add Webcache to the mix, you have to tell Webcache to cache the pages generated by Apex. Webcache will generally cache based upon a url, and generally does not cache posts (page submits) but only gets (links). As your links will have a session ID in them (and you will have a unique cookie value), Webcache will only provide a cached response to the user if the user has already visited that page within that session (with precisely the same URL). This can be great, if you have a page that does not change much, but it can be a nightmare if either the data in the database changes (and you want the change reflected) on the page, or if you have some other process that should cause the page to change (e.g. if you set some search criteria in a process, not in the url and the report where clause should change). In either case, if Webcache responds, it never calls the db to regenerate the page, you just get the exact data on the page. The way around this is to have the database issue an invalidation to Webcache whenever either of these cases occur. As you can see, this can be a lot of work. It's a lot to just type up the description of it! The only cases where it makes a lot of sense is when you have a lot of content that does not change on a few pages or really big content (e.g. documents, images) that you will download more than once in a session.
    I hope this helps. Drop me a note if you want more details.
    Anton

  • Monitor connected front end users

    Hi ,
    I have an application with access control list and table which holds application users / used for authorization etc ...
    at the database level I would like to see and know which session belongs to which fron end users!
    at the database level I can only see session id's and application's username which is htmldb_public_user.... and its unique for every user..
    lookin at Utilities>Database Monitor>Sessions page I can only see one developer connected! but cant see session or session id for front end users? is there anyway to find out the session info for this user?
    Thanks

    its the same question with a diffrence that he is trying to have diffrent applications login as diffrent username so he can trace applications individually(which is what im intrested in too) where as im more intrested in knowing the session id for each front end users who are viewing/inserting or deleting data through the applications! hope this makes sense!
    I dont undrestand below response!
    Bill,
    FYI, the engine does this for each database session:
    begin dbms_application_info.set_client_info(g_user); dbms_session.set_identifier(substr(g_user,1,(64 - length(g_instance)-1))||':'||to_char(g_instance)); dbms_application_info.set_module('APEX:APPLICATION '||to_char(g_flow_id),'PAGE '||to_char(g_flow_step_id)); exception when others then null; end;
    ...where g_user is the authenticated user, g_flow_id is the application ID, g_flow_step_id is the page ID, and g_instance is the Application Express sessionID. I don't know where to tell you to look for these markers but they will be associated with the database sessions that you're seeing which are owned by APEX_PUBLIC_USER.
    We are looking to move to a 4 RAC environment which is creating many questions concerning APEX architecture.
    I've seen all your other posts about this and IMO, there are no questions to be answered about the architecture of Application Express vis-a-vis RAC, and vice versa.
    Thanks
    Message was edited by:
    friendlier

  • Position of column 2

    Hello
    I use column 2 reguraly to create a second (horizontal) region.
    where in the apex architecture is the position of this second column regions determined?
    I notice that this second region on large screens is postiioned extremely to the right leaving a huge amount of withe space between region 1 (column 1) and region 2 (column 2)
    Both regions are in the body
    Kind Regards Erik

    Erik Trip - Darwin IT wrote:
    Hello
    I use column 2 reguraly to create a second (horizontal) region.
    where in the apex architecture is the position of this second column regions determined?
    I notice that this second region on large screens is postiioned extremely to the right leaving a huge amount of withe space between region 1 (column 1) and region 2 (column 2)
    Both regions are in the body"column 2" indicates that this is done using an HTML table. It's likely that the horizontal expansion is caused by the use of HTML <tt>width</tt> attributes or CSS <tt>width</tt> properties in theme HTML or CSS.
    As always with any layout/visual appearance problem you MUST reproduce the problem on apex.oracle.com or provide full details in order for anyone to understand, replicate and troubleshoot it:
    <li>APEX version
    <li>DB version and edition
    <li>Web server architecture (EPG, OHS or APEX listener)
    <li>Browser(s) used
    <li>Theme
    <li>Templates
    <li>Region type

  • Working with multiple databases

    Suppose I have a large project that follows the formal "SDLC" model for software development; it has various stages, environments, development, integration testing, system testing, UAT, etc. Each of these environments is on its own dedicated Oracle database.
    An query-only Apex application is built as a testing aid for the various environments to quickly see reports, test data conditions, etc. This application is deployed to all the environments.
    With other web development technologies (PHP, ASP/.NET, etc) which live outside Oracle and access Oracle using a userid/connect string. If some aspect of the application needs to be changed, it is done in 1 place (the application) and the new/modified functionality is available for use against all the enviroments (just change the connect string in the URL or some config file to access different environments).
    With Apex, the change to the application has to be done in all the 4 environments. This seems like a case where the Apex architecture (all app metadata in Oracle) is a disadvantage.
    Comments? Thanks

    That would be that case if you are only talking about only moving through the SDLC with your database changes yes? In many cases, you make changes both to the underlying database structure/code and the application (PHP, ASP, etc) so your application would "follow" your database code wouldn't it?
    chet
    *Disclaimer:  I have not worked in such an environment in about 2 years, so I'm a bit rusty.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Architecture for APEX using iAS 10.1.2 and 10g with Dataguard replication

    We are currently using APEX in a stand-alone architecture using iAS 10.1.2 on with 10g as the DB(all on the same server). Our APEX apps are fast becoming a significant part of our production environment and I would like to set up a redundant failover site using Dataguard replication. I am very familiar with the DB failover, but I am struggling with how I can set up iAS on the standby server.
    Oracle guidelines for iAS failover using Dataguard (this is not AS Dataguard) specify that the primary and standby server local hostname must be identical for the failover architecture to work unless you use a virtual host name. Due to restrictions in our environment I am not able to set the lcoal hostname the same on the primary and standby servers. As an alternative I installed iAS(10.1.4) using a virtual hostname on my primary server, but it appears that the servername that shows up in all the installation references after the installation is still the actual server name, not the virtual name.
    I am looking for guidance from someone that has successfully set up a iAS failover architecture using dataguard on servers that do not have the same local hostname.
    thanks

    Hi,
    I have the same problem. Do you find something about putting jsf in OAS 10.1.2 ?
    Regards

  • Apex  : Ideal Architecture

    Work for Qualcomm and we using Ebusiness 11i, Oracle 10g.
    Evaluating APEX for and was hoping to get answers on what is the best practice from an architecture point of view.
    Should we run a separate database just for APEX ? We Oracle ADF 11g instance setup. Can APEX run inside this container .
    We do not want to run mod_pls/sql on the ebiz database. Both from a security and a performance point of view.

    Hi,
    What is the best architecture depends on what you are trying to achieve.
    You can run APEX in a separate database from EBS and this has the advantage that you are not tied to the EBS database versions. However, you will have to retrieve all EBS data used in the APEX application using a database link which is more difficult to do and will perform less well. You also may want to authenticate APEX users using the EBS authentication and run other process in EBS from APEX. Again this is possible but more difficult using an database link. Also creating a link into EBS weakens the system security.
    You cannot really run APEX inside ADF container.
    I wouldn't rule out running APEX in the same database from either a security or performance point of view. The APEX security is good and can be hardened if that is a requirement. The APEX processing can be managed within the database using resource groups or RAC nodes so that it does not impact the EBS processing. This article (http://www.oracle.com/technology/products/database/application_express/pdf/apex_ebs_wp_cabot_consulting.pdf) has some information on the EBS/APEX infrastructure.
    Rod West

  • APEX application development with an existing data model

    Dear all,
    We - as a company - are trying to build an application in ApEx with an existing data model. The idea is that the data model that has all sorts of TAPIs and business rules defined is going to be re-used in an ApEx environment. I am actually wondering whether this is possible, wise, feasible. When I am building some simple pages on one specific table, which has approx. 35 fields, sometimes the triggers around that table fail. Before I am actually going to dive in to try and sort these problems I am wondering whether this use of a data model in an ApEx environment is wise.
    I mean, when you build an ApEx application there are usually no triggers and TAPIs available. My logic is that the ApEx application can look after validation and stuff.
    Does anybody experienced have anything smart and useful to say about this. Any feedback is appreciated.
    Kind regards,
    -victorbax
    -leiderdorp, the netherlands

    Hey vik,
    At my company we rarely use the standard APEX wizards because of multi-linguility (on data level) and error management issues.
    We always create an API in PL/SQL and call the procedures for APEX making APEX the 'view' layer in a kind of model-view-controller architecture.
    The main thing to keep in mind is maintainability, if you're working with an existing datamodel with an API that works it's probably best to just created forms and reports through APEX and then calling the appropriate pl/sql (packaged) procedure manually. We believe that this kind of architecture has the downside of being a little more work initially but it's much easier to maintain large projects through a self written API and take care of issues like error handling, logging and multi-linguility through a self written API.
    Kind Regards,
    Geert Guldentops

  • Need help to develop CMDB using Apex

    Hi,
    We have a large number of servers, databases, environments, applications, etc for which we have planned to create a repository. Hence we need to develop a CMDB for the same.
    I have gone through the example tutorials related to Apex.
    However, I have never used Oracle 11g or Apex or SQL*Plus, which are required for this purpose.
    After installing Oracle11g, how do I create a test/fresh database in Oracle before installing Apex in it?
    So can someone help me with a detailed procedure to implement this CMDB, including installation of Apex?
    Thanks in advance.
    You can also reach me at [email protected]
    Regards
    Sharath
    Edited by: 906997 on Jan 10, 2012 1:35 AM
    Edited by: 906997 on Jan 10, 2012 1:55 AM

    Hello Sharath,
    >
    After installing Oracle 11g, we need to create some database in it so that Apex can be installed in it right?
    Can you please guide me on how to create the first database or some database in Oracle 11g?
    >
    You have to create a database if only you have installed Oracle 11g it with Install Database Software Only instead of Create and Configure Database option.
    If don't have a database now you have to create one with Database Configuration Assistant, suppose you have Oracle Database 11g Release 1:
    http://docs.oracle.com/cd/B28359_01/server.111/b28301/install003.htm#BABEIAID
    Besides this forum category is dedicated to Oracle Application Express, for Oracle Database related questions please post on:
    {forum:id=61}
    You will get appropriate answer when you post in appropriate forum.
    In order to get accurate/appropriate response you should include at least following information with your question:
    <ul>
    <li>Full APEX version</li>
    <li>Full Database version</li>
    <li>APEX Web server architecture (EPG, OHS or APEX listener)</li>
    <li>Browser(s) and version(s) used</li>
    <li>Operating system with version</li>
    </ul>
    Please read the [url https://wikis.oracle.com/display/Forums/Forums+FAQ]FAQ and [url https://forums.oracle.com/forums/ann.jspa?annID=1324]forum instructions for more information on using OTN forums effectively.
    Please update your forum profile with a real handle instead of *906997*.
    Hope it helps!
    Regards,
    Kiran

  • APEX SEND EMAIL FUNCTION NOT SENDING EMAIL

    Hi All,
    For some reason that I can't figure out is not send any email... Could yo please help me to find it?
    DECLARE
    CreationDate date;
    ClosureDate date;
    IncidentsQty NUMBER;
    Tool varchar(100);
    BEGIN
    SELECT COUNT(STUCK_RELATED_TO_PROBLEM) into IncidentsQty
    FROM INCIDENTS
    WHERE STUCK_RELATED_TO_PROBLEM = :P57_INCIDENT_ID;
    SELECT IDATE  INTO CreationDate
    FROM PROBLEMS
    WHERE ID = :P57_INCIDENT_ID;
    SELECT CDATE  INTO ClosureDate
    FROM PROBLEMS
    WHERE ID = :P57_INCIDENT_ID;
    SELECT TOOL  INTO Tool
    FROM PROBLEMS
    WHERE ID = :P57_INCIDENT_ID;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    APEX_MAIL.send(
    p_to =>  '[email protected]',
    p_from => :app_user,
    p_body => 'SERVICE DESK NOTIFICATIONS: NEW UPDATE HAS BEEN REPORTED INTO AN PROBLEM',
    p_body_html => '<p>The details of the problem closed are the following: <br>
    <p>Creation date: ' || CreationDate || ' <br>
    Closure date:  '|| ClosureDate ||'<br>
    Incidents Qty: '|| IncidentsQty ||'<br>
    Observations: '|| :P57_IUPDATE ||'</p><br>
    p_SUBJ => 'The problem for the tool ' || TOOL || ' (ID# '|| :P57_INCIDENT_ID ||') has been closed.',
    p_cc => '',
    p_bcc => NULL ,
    p_replyto => NULL
    END;

    Hello Bernardo,
    >
    For some reason that I can't figure out is not send any email... Could yo please help me to find it?
    >
    Please do provide necessary information so the picture about your problem is clear for the forum members.
    The blog post by one of the eminent person working with Oracle Technologies @Tom Kyte might help:
    http://tkyte.blogspot.in/2005/06/how-to-ask-questions.html
    Now coming to your posted procedure snippet:
    APEX_MAIL.send (
    p_to =>  '[email protected]',
    p_from => :app_user,
    p_body => 'SERVICE DESK NOTIFICATIONS: NEW UPDATE HAS BEEN REPORTED INTO AN PROBLEM',
    p_body_html => '<p>The details of the problem closed are the following: <br>
    <p>Creation date: ' || CreationDate || ' <br>
    Closure date:  '|| ClosureDate ||'<br>
    Incidents Qty: '|| IncidentsQty ||'<br>
    Observations: '|| :P57_IUPDATE ||'</p><br>',
    p_SUBJ => 'The problem for the tool ' || TOOL || ' (ID# '|| :P57_INCIDENT_ID ||') has been closed.',
    p_cc => '',
    p_bcc => NULL ,
    p_replyto => NULL
    );As you have not given APEX Version information I will go with APEX Version Application Express 4.2.0.00.27.
    I would recommend you to go through the documentation of [url http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_mail.htm#CIHDIEJI]APEX_MAIL to help you debug the problem.
    This is what i want you to check with your email configuration:
    <ul>
    <li>Have you configured the email settings on the Instance Settings page.
    Refer: http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35129/adm_mg_service_set.htm#BEJBCEEH</li>
    <li>Have you checked the configuration works fine? You can use the examples given in the documentation of APEX_MAIL.SEND Procedure.
    Refer: http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_mail.htm#CHDDAAJE
    Note: User SQL Commands from your APEX Workspace for this purpose.
    Also after sending email check for the error in APEX_MAIL_QUEUE or APEX_MAIL_LOG using query:
    -- Check whether the mail has been queued
    SELECT *
       FROM APEX_MAIL_QUEUE;
    -- Push the mail for delivery
    BEGIN
      APEX_MAIL.PUSH_QUEUE;
    END;
    -- Check whether the mail has been delivered without any error
    -- check for MAIL_SEND_ERROR column
    SELECT *
       FROM APEX_MAIL_LOG;</li>
    <li>Are you using Oracle Database Release 11.1 or higher version ? If yes then you have to configure network services to enable the host to send email. Refer: http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/sec_admin_ssl.htm#HTMDB12006</li>
    <li>Are you invoking the APEX_MAIL procedures through a database package? If yes then you have to set the SECURITY_GROUP_ID.
    Refer the starting of APEX_MAIL documentation.
    Use the following code before invoking APEX_MAIL procedures:
    p_app_id should be the Application Number of your APEX application.
    for c1 in (
       select workspace_id
         from apex_applications
        where application_id = p_app_id )
    loop
       apex_util.set_security_group_id(p_security_group_id =>
    c1.workspace_id);
    end loop;</li>
    </ul>
    This is what i find doubting about the code snippet:
    <ul>
    <li>Is APP_USER passing valid email ID?</li>
    <li>Note the usage of utl_tcp.crlf in the APEX_MAIL.SEND procedure examples in the documentation.</li>
    <li>Why have you passed empty string to the parameter p_cc ? Note that empty string is not equal to NULL.</li>
    <li>Instead of passing data directly to the parameters you can use variables, assign data to variables and pass variables instead.</li>
    </ul>
    In order to get accurate/appropriate response you should include at least following information with your question:
    <ul>
    <li>Full APEX version</li>
    <li>Full Database version</li>
    <li>APEX Web server architecture (EPG, OHS or APEX listener)</li>
    <li>Browser(s) and version(s) used</li>
    <li>Operating system with version, architecture(32/64)</li>
    </ul>
    The above information will help the forum members to ascertain the problem context and post most relevant response.
    Please read the [url https://wikis.oracle.com/display/Forums/Forums+FAQ]FAQ and [url https://forums.oracle.com/forums/ann.jspa?annID=1324]forum instructions for more information on using OTN forums effectively.
    Please perform a [url https://forums.oracle.com/forums/search!default.jspa]forum search before posting a question as this will help reduce duplicate threads.
    Please mark the reply as helpful or correct as this will help other members on the forum with similar question.
    Hope it helps!
    Regards,
    Kiran

  • Problem with XML in APEX ORA-06502

    i, I have a problem with XML generation, I developed an application in APEX, and in a html page I have this process:
    declare
    l_XML varchar2(32767);
    begin
    select xmlElement
    "iva",
    xmlElement("numeroRuc",J.RUC),
    xmlElement("razonSocial", J.RAZON_SOCIAL),
    xmlElement("idRepre", J.ID_REPRE),
    xmlElement("rucContador", J.RUC_CONTADOR),
    xmlElement("anio", J.ANIO),
    xmlElement("mes", J.MES),
    xmlElement
    "compras",
    select xmlAgg
    xmlElement
    "detalleCompra",
    --xmlAttributes(K.ID_COMPRA as "COMPRA"),
    xmlForest
    K.COD_SUSTENTO as "codSustento",
    K.TPLD_PROV as "tpldProv",
    K.ID_PROV as "idProv",
    K.TIPO_COMPROBANTE as "tipoComprobante",
    to_char(K.FECHA_REGISTRO, 'DD/MM/YYYY') as "fechaRegistro",
    K.ESTABLECIMIENTO as "establecimiento",
    K.PUNTO_EMISION as "puntoEmision",
    K.SECUENCIAL as "secuencial",
    to_char(K.FECHA_EMISION, 'DD/MM/YYYY') as "fechaEmision",
    K.AUTORIZACION as "autorizacion",
    to_char(K.BASE_NO_GRA_IVA, 9999999999.99) as "baseNoGraIva",
    to_char(K.BASE_IMPONIBLE, 9999999999.99) as "baseImponible",
    to_char(K.BASE_IMP_GRAV, 9999999999.99) as "baseImpGrav",
    to_char(K.MONTO_ICE, 9999999999.99) as "montoIce",
    to_char(K.MONTO_IVA, 9999999999.99) as "montoIva",
    to_char(K.VALOR_RET_BIENES, 9999999999.99) as "valorRetBienes",
    to_char(K.VALOR_RET_SERVICIOS, 9999999999.99) as "valorRetServicios",
    to_char(K.VALOR_RET_SERV_100, 9999999999.99) as "valorRetServ100"
    xmlElement
    "air",
    select xmlAgg
    xmlElement
    "detalleAir",
    xmlForest
    P.COD_RET_AIR as "codRetAir",
    to_char(P.BASE_IMP_AIR, 9999999999.99) as "baseImpAir",
    to_char(P.PORCENTAJE_AIR, 999.99) as "porcentajeAir",
    to_char(P.VAL_RET_AIR, 9999999999.99) as "valRetAir"
    from ANEXO_COMPRAS P
    where P.ID_COMPRA = K.ID_COMPRA
    AND P.ID_INFORMANTE_XML = K.ID_INFORMANTE_XML
    xmlElement("estabRetencion1", K.ESTAB_RETENCION_1),
    xmlElement("ptoEmiRetencion1", K.PTO_EMI_RETENCION_1),
    xmlElement("secRetencion1", K.SEC_RETENCION_1),
    xmlElement("autRetencion1", K.AUT_RETENCION_1),
    xmlElement("fechaEmiRet1", to_char(K.FECHA_EMI_RET_1,'DD/MM/YYYY')),
    xmlElement("docModificado", K.DOC_MODIFICADO),
    xmlElement("estabModificado", K.ESTAB_MODIFICADO),
    xmlElement("ptoEmiModificado", K.PTO_EMI_MODIFICADO),
    xmlElement("secModificado", K.SEC_MODIFICADO),
    xmlElement("autModificado", K.AUT_MODIFICADO)
    from SRI_COMPRAS K
    WHERE K.ID IS NOT NULL
    AND K.ID_INFORMANTE_XML = J.ID_INFORMANTE
    AND K.ID BETWEEN 1 AND 25
    ).getClobVal()
    into l_XML
    from ANEXO_INFORMANTE J
    where J.ID_INFORMANTE =:P3_MES
    and J.RUC =:P3_ID_RUC
    and J.ANIO =:P3_ANIO
    and J.MES =:P3_MES;
    --HTML
    sys.owa_util.mime_header('text/xml',FALSE);
    sys.htp.p('Content-Length: ' || length(l_XML));
    sys.owa_util.http_header_close;
    sys.htp.print(l_XML);
    end;
    Now my table has more than 900 rows and only when I specifically selected 25 rows of the table "ANEXO_COMPRAS" in the where ( AND K.ID BETWEEN 1 AND 25) the XML is generated.+
    I think that the problem may be the data type declared "varchar2", but I was trying with the data type "CLOB" and the error is the same.+
    declare
    l_XML CLOB;
    begin
    --Oculta XML
    sys.htp.init;
    wwv_flow.g_page_text_generated := true;
    wwv_flow.g_unrecoverable_error := true;
    --select XML
    select xmlElement
    from SRI_COMPRAS K
    WHERE K.ID IS NOT NULL
    AND K.ID_INFORMANTE_XML = J.ID_INFORMANTE
    ).getClobVal()
    into l_XML
    from ANEXO_INFORMANTE J
    where J.ID_INFORMANTE =:P3_MES
    and J.RUC =:P3_ID_RUC
    and J.ANIO =:P3_ANIO
    and J.MES =:P3_MES;
    --HTML
    sys.owa_util.mime_header('text/xml',FALSE);
    sys.htp.p('Content-Length: ' || length(l_XML));
    sys.owa_util.http_header_close;
    sys.htp.print(l_XML);
    end;
    The error generated is ORA-06502: PL/SQL: numeric or value error+_
    Please I need your help. I don`t know how to resolve this problem, how to use the data type "CLOB" for the XML can be generate+

    JohannaCevallos07 wrote:
    Now my table has more than 900 rows and only when I specifically selected 25 rows of the table "ANEXO_COMPRAS" in the where ( AND K.ID BETWEEN 1 AND 25) the XML is generated.+
    I think that the problem may be the data type declared "varchar2", but I was trying with the data type "CLOB" and the error is the same.+
    The error generated is ORA-06502: PL/SQL: numeric or value error+_
    Please I need your help. I don`t know how to resolve this problem, how to use the data type "CLOB" for the XML can be generate+The likeliest explanation for this is that length of the XML exceeds 32K, which is the maximum size that <tt>htp.p</tt> can output. A CLOB can store much more than this, so it's necessary to buffer the output as shown in +{message:id=4497571}+
    Help us to help you. When you have a problem include as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    And always post code wrapped in <tt>\...\</tt> tags, as described in the FAQ.
    Thanks

  • Apex conditional field in "SQL Query (updateable report)" region

    I have a multi-row region that displays values and allows entries in a number of fields. I should like the fields to be conditional in that they do not permit entry, but still display, if certain conditions apply (e.g. older rows greyed out). Can this be done?
    I have searched Google and this forum but all the threads I have found relate to field formatting or display/non-display.
    Many thanks in advance Dave Barber
    [Apex=4.1.1.00.23; Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production]
    Edited by: user13515136 on 03-Sep-2012 00:05

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "user13515136".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    I have a multi-row region that displays values and allows entries in a number of fields.Provide exact details of how this has been implemented. (An example on apex.oracle.com is always a good way to do this.)
    I should like the fields to be conditional in that they do not permit entry, but still display, if certain conditions apply (e.g. older rows greyed out). Can this be done? Almost anything can be done, often in multiple ways. Which are appropriate may be dependent on a particular implementation, the skills available to implement it, and the effort you're willing to expend on it. Hence it's necessary to provide full details of what you've done so far...

  • Need EXPERT's suggestion for APEX CHART SERIES

    Hello Everyone,
    I have been trying to solve an issue with my apex line chart. The scenario is as follows:
    I have a table called revenue. revenues per year are saved in it. and revenues are generated from three sources which are also saved in the same table.
    I have made a line chart on it. works well.
    Now I have to show that if the value of one of the sources had fallen, how must have it affected the total. I made a number field that takes an estimated change value, and build my sql query with it. it works but the problem is that it changes the non-affected source too. it must change the value of the affected source only and hence the total value.
    I hope I make sense and anybody can suggest something.
    bold or I will put it this way, how can I write a select statement for a chart series so that one of the rows value does not change and the other two change. ... ?
    Edited by: Samooray92 on May 30, 2013 2:41 PM

    Samooray,
    Let's work with this question since there is more detail here than in the other one. {thread:id=2543702}
    First it's always help to know:
    Full APEX version
    Full DB/version/edition/host OS
    Web server architecture (EPG, OHS or APEX listener/host OS)
    Browser(s) and version(s) used
    And sometimes this information as well.
    Theme
    Template(s)
    Region/item type(s)
    When a question goes unanswered for a while, there is no need to reply to it or to start a new question. You can edit the original question and just add "Bump" at the bottom and save the changes. This will bump it back to the top of the question list. And by that time, you might think of additional information you can add to the question.
    Say, why would a question go unanswered? Well, easy questions and frequently asked questions with well-known answers can be answered right away. Your question seems more complicated and I don't think we have all the information we need to understand exactly what the question is.
    You are doing a "series" chart. What kind of series chart: bar, column, line? What is each series? For example, components of revenue might be 1) sales, 2) licensing revenue and 3) other. Then you might have one series for sales, a second for licensing revenue and a third for other.
    Could you mock up a trivial example on apex.oracle.com http://apex.oracle.com/pls/apex/f?p=4700:1:0::::: ?
    Regards,
    Howard

  • Image is not displayed in APEX Form with APEX utility Function

    Dear APEX experts,
    As i am new to the oracle apex development. I have just created the basic employee information form in which i upload the photograph of the employee. The photograph gets uploaded but it does not display properly. I have already referred the sample database application to display the image. Moreover, i have followed the same steps as it is used to display the product image in that application. Still i am unable to get result. I am getting following output:
    <img src="apex_util.get_blob_file?a=35682&s=101496289174102&p=15&d=10639237623242912156&i=10639236703270912154&p_pk1=21&p_pk2=&p_ck=FCA12832591A1C706D76FDD589E551A2" />
    Please help me seniors to solve this issue. How to display the image using this utility.

    mehpandya wrote:
    I have observed following HTML code after inspecting the two application.
    1.Sample Database application:
    In this application , the product image is uploaded and displayed correctly and following code is rendered in the HTML source.
    <span id="P6_IMAGE" class="display_only" ><img src="apex_util.get_blob_file?a=64703&s=134073736366663&p=6&d=25732916709090782422&i=25433760606377189086&p_pk1=1&p_pk2=&p_ck=7E23190CC0BFE98BBE4CCE2ADFBBEF26" /></span>
    2.Sample HRMS Application - Which i have created for learning.
    In this application , the employee photo is uploaded but it is not displayed correctly. Following is code is rendered in the HTML.
    "<span id="P15_EMPIMG" class="display_only" >&lt;img src="apex_util.get_blob_file?a=35682&amp;s=100541516379272&amp;p=15&amp;d=10639237623242912156&amp;i=10639236703270912154&amp;p_pk1=21&amp;p_pk2=&amp;p_ck=31A8328E0F5754D7CBD0FC0C6313B38A" /&gt;</span>"
    Hence , in my application the code is not rendered perfectly and syntax is not completed.
    following characters are rendered like this.: &lt , &quot , &gt , &amp.
    So, is this the reason of not displaying the image???Yes.
    To get a Display Item to render as HTML, in the item definition Security section set Escape special characters to No.
    For a report column, ensure the Display Text As report column attribute is Standard Report Column rather than the default Display as Text (escape special characters).
    Use a Display Image item and declarative BLOB support instead of this clunky manual method.
    Please read the FAQ and forum sticky threads (if you haven't done so already.
    You'll get a faster, more effective response to your questions by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s)
    The APEX documentation is here.

  • How to SCAN uploaded files for VIRUS in APEX

    part 1:
    Goal:
    Do a virus scan of the uploaded file from APEX application prior to storing the file in custom tables.
    The process:
    Followed the document from www.developer.com:
    Implementing an Anti-Virus File Scan in JEE Applications
    By Vlad Kofman
    Go to page: 1 2 3 Next
    This article will discuss one of the ways to implement antivirus file scanning in Java, particular in the JEE applications. Viruses, Trojan Horses, and different malware and spyware are a real problem for current computer environments, and especially for the Windows operating system. If you are designing any application in Java that has a requirement to be able to upload external files, you have a potential security risk. By uploading, I mean any way to get the external file inside of the corporate firewall be it via HTTP protocol or any other means. It is quite common to have this type of requirement in an enterprise application and with Java being one of the most popular web development platforms, it is unfortunate that this type of gaping security risk is quite often overlooked.
    Java's Development Kit (JDK) does not have any means to do the antivirus scan right out of the box. This is primarily because Java is a programming language, and does not have any virus scanning packages. Furthermore, anti-virus software is not Sun's area of expertise or business model. Developing this type of software (or Java package), and more importantly maintaining it, would be a huge task for Sun. Mainly because viruses are constantly evolving and keeping virus definitions up-to-date is a daunting task. Large companies such as McAffee, Symantec, or Zone Labs develop virus detecting and combating products and spend a lot of resources to maintain them.
    Application Environment
    To implement a virus file scan in Java, a third-party package needs to be used. For the purposes of this article, I will use Symantec Scan Engine (SSE) package, which comes with Java APIs. This package is an application that serves as a TCP/IP server and has a programming interface and enables Java applications to incorporate support for content scanning technologies. For this article, I used Symantec Scan Engine 5.1, which is available as a Unix or Windows install.
    If you are using an anti-virus package from the different vendor, you will need to investigate what kind of APIs are available; however, the general approach should be similar. Also, note that my implementation can be used with JEE technology and any modern MVC framework such as Struts or Spring.
    The architecture is as follows: A server machine needs to have SSE running at all times. This can be the same machine that hosts your Application Server, but in an enterprise environment this should be a different machine. The Default Port needs to be open through the firewall to allow communication with the scan engine. All JEE applications that need to do file scanning can talk to the SSE server machine through a default port. Also, multiple applications running on different application servers can re-use the same scanning server. For more information, you should refer to the Symantec Scan Engine (SSE) Installation Guide, available on the Symantec web site.
    When an external file that needs to be scanned is sent to the SSE via its programming interface (Java APIs using the default port), before any other operation on the file is performed, the SSE returns a result code. For instance, a file is uploaded by an external user into the web email type application as an attachment; then, the SSE API is invoked by the application and the return code of pass or fail determines the outcome of the upload and whether that email can actually be sent. If you have an account on Yahoo mail, you probably have seen that Yahoo is using Norton Antivirus to scan all attachments, although no Java.
    Click here for a larger image.
    Figure 1: Screen shot from Yahoo
    For details on the Scan Engine Server Installationm please see the Symantec Scan Engine (SSE) Implementation Guide from Symantec.
    Here are some key things to remember about SSE:
    •     Java 2 SE Runtime (JRE) 5.0 Update 6.0 or later must be installed on the server before the SSE installation is done.
    •     After installation, verify that the Symantec Scan Engine daemon is running. At the Unix command prompt (if it's a Unix install), type the following command:
    ps –ea | grep sym.
    A list of processes similar to the following should appear:
    o     5358 ? 0:00 symscan
    o     5359 ? 0:00 symscan
    If nothing is displayed the SSE process did not start.
    If the SSE process did not start, type the following command to restart SSE:
    /etc/init.d/symscan restart
    •     Keeping the virus definition up to date is the most important task and if new updates are not installed, the whole scan becomes ineffective. Symantec automatically downloads the most current file definitions through LiveUpdate. Please make sure that firewall rules are in place to allow the host server to connect to the Symantec update service.
    Project Setup
    For the purposes of this article, I included a wrapper for the Symantec SSE APIs, av.jar, which has Symantec Java APIs and serves as a client to the SSE server and takes care of all communications with the server. Please refer to the download source section. The av.jar should be included in the Java CLASSPATH to work with the SSE. This jar contains a class called AVClient that takes care of actually sending the files to SSE as byte arrays and returning the result.
    In my project setting, I added three variables to be accessed via the System.getProperty mechanism. For example:
    AV_SERVER_HOST=192.168.1.150
    AV_SERVER_PORT=1344
    AV_SERVER_MODE=SCAN
    The AV_SERVER_HOST is the host name or IP of the machine where Scan Engine is installed.
    The AV_SERVER_PORT is the port where Scan Engine listens for incoming files.
    The AV_SERVER_MODE is the scan mode which can be:
    •     NOSCAN: No scanning will be done (any keyword that does not start with "SCAN" will result in ignoring the call to the Scan Engine and no files will be transferred for scanning).
    •     SCAN: Files or the byte stream will be scanned, but the scan engine will not try to repair infections.
    •     SCANREPAIR: Files will be scanned, the scan engine will try to repair infections, but nothing else will be done.
    •     SCANREPAIRDELETE: Files will be scanned, the scan engine will try to repair infections, and irreparable files will be deleted.
    Note: For the file stream (byte array) scanning, the only meaning full values are "SCAN" and "NOSCAN".
    Using the SSE Scanning Java APIs
    In any class where scan is required, call the scanning API provided in the AVClient object located in the av.jar. The AVClient object will establish connection to the Scan Engine server and has the following APIs:
    Figure 2: The significant APIs for the communication with to the Scan Engine Server.
    If scanning a file on the file system, in SCAN only mode, use the call that accepts filename only.
    If scanning a file on the file system, with SCANREPAIR or SCANREPAIRDELETE, use the call that accepts input and output file names.
    If scanning an in-memory file (byte array), use the call accepting byte array.
    For example:
    import com.av.*;
    Initialize setup parameters:
    static String avMode =
    (System.getProperty("AV_SERVER_MODE") != null)
    ? (String) System.getProperty("AV_SERVER_MODE") : "NOSCAN";
    static boolean scan = avMode.startsWith("SCAN");
    static String avServer =
    (String) System.getProperty("AV_SERVER_HOST");
    static int avPort =
    Integer.parseInt( (String) System.getProperty("AV_SERVER_PORT"));
    Scan check example for an in-memory file byte array:
    public void scanFile(byte[] fileBytes, String fileName)
    throws IOException, Exception {
    if (scan) {
    AVClient avc = new AVClient(avServer, avPort, avMode);
    if (avc.scanfile(fileName, fileBytes) == -1) {
    throw new VirusException("WARNING: A virus was detected in
    your attachment: " + fileName + "<br>Please scan
    your system with the latest antivirus software with
    updated virus definitions and try again.");
    Note that if you are using this code inside of the MVC handler, you can throw a custom VirusException and check for it in the calling method and perform any necessary cleanup. I have included the class in the AV Jar as well.
    For example:
    catch (Exception ex) {
    logger.error(ex);
    if (ex instanceof VirusException) {
    // do something here
    else {
    // there was some other error – handle it
    For more details on the Scan Engine Client API, please see Symantec Scan Engine Software Developers Guide.
    Continuation in part2

    part 4:
    c)     Clienttester.java – This is the gui app set to test if the configuration is working or not. This gui uses the method scanfile(inputfile, outputfile) as you can see the result in the outputpane of the jframe.
    * clienttester.java
    * Created on April 12, 2005, 2:37 PM
    * @author george_maculley
    package com.av;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class clienttester
    implements ActionListener {
    // private String ipaddress = "127.0.0.1";
    private String ipaddress = "199.209.150.58";
    //private String ipaddress = "192.168.0.55";
    static JFrame frame;
    JFileChooser chooser = new JFileChooser();
    TextField pathtofile = new TextField(System.getProperty("user.home"), 30);
    // TextField pathtooutfile= new TextField(System.getProperty("user.home"),30);
    private int port = 1344;
    JButton filechooser = new JButton("Browse to file"); ;
    private String originalfilename;
    private String outputfilename;
    JButton scanbutton = new JButton("Scan");
    TextArea outputarea = new TextArea(20, 40);
    TextField iptext = new TextField("127.0.0.1", 16);
    TextField porttext = new TextField("1344", 5);
    AVClient mine;
    JRadioButton choosescan = new JRadioButton("SCAN");
    // JRadioButton choosedelete= new JRadioButton("SCANREPAIRDELETE");
    /** Creates a new instance of gui */
    public clienttester() {
    public clienttester(java.lang.String ip, java.lang.String infile, java.lang.String outfile, int port) {
    this.ipaddress = ip;
    this.port = port;
    this.originalfilename = infile;
    this.outputfilename = outfile;
    boolean setValues(java.lang.String ip, java.lang.String infile, java.lang.String outfile, int port) {
    this.ipaddress = ip;
    this.port = port;
    this.originalfilename = infile;
    this.outputfilename = outfile;
    return (true);
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
    JComponent c = (JComponent) actionEvent.getSource();
    if (c == filechooser) {
    int retval = chooser.showDialog(frame, null);
    if (retval == JFileChooser.APPROVE_OPTION) {
    File theFile = chooser.getSelectedFile();
    if (theFile != null) {
    pathtofile.setText(theFile.getPath());
    // pathtooutfile.setText(theFile.getPath());
    JOptionPane.showMessageDialog(frame, "You chose this file: " + theFile.getPath());
    if (c == scanbutton) {
    //return object that can be passed to AVClient
    String policy;
    int thisport;
    int scanresult;
    String thisip;
    String inputfile;
    String outputfile;
    outputarea.append("Server: " + iptext.getText() + "\r\n");
    if (choosescan.isSelected()) {
    policy = "SCAN";
    else {
    policy = "SCANREPAIRDELETE";
    thisport = new Integer(porttext.getText()).intValue();
    thisip = iptext.getText();
    //mine= new AVClient(iptext.getText(),porttext.getText(),policy);
    mine = new AVClient(iptext.getText(), thisport, policy);
    if (mine.test() == 1) {
    outputarea.append("Sorry. Incorrect parameters specified.\r\n");
    System.exit(1);
    else {
    outputarea.append("Connection to SAVSE initialized.\r\n");
    inputfile = pathtofile.getText();
    // outputfile=pathtooutfile.getText();
    outputfile = "/tmp";
    outputarea.append("Scanning file " + inputfile + " \r\n");
    if (policy == "SCAN") {
    scanresult = mine.scanfile(inputfile);
    else {
    scanresult = mine.scanfile(inputfile, outputfile);
    if (scanresult == 0) {
    outputarea.append("File is clean.\r\n");
    else if (scanresult == -1) {
    outputarea.append("File is infected. \r\n");
    else {
    outputarea.append("Scan error.\r\n");
    void display() {
    Frame f = new Frame("SAVSE JAVA ICAP Client");
    f.setLayout(new GridLayout(1, 2));
    JPanel lpanel = new JPanel(new GridLayout(7, 1));
    JPanel ippanel = new JPanel();
    JPanel portpanel = new JPanel();
    JPanel rpanel = new JPanel();
    JPanel outputpanel = new JPanel();
    JPanel buttonpanel = new JPanel();
    JPanel pathpanel = new JPanel();
    // JPanel outpathpanel= new JPanel();
    JPanel policypanel = new JPanel();
    ButtonGroup policygroup = new ButtonGroup();
    filechooser.addActionListener(this);
    scanbutton.addActionListener(this);
    choosescan.setSelected(true);
    policygroup.add(choosescan);
    // policygroup.add(choosedelete);
    buttonpanel.setBorder(BorderFactory.createTitledBorder("Scan Policy"));
    buttonpanel.add(choosescan);
    // buttonpanel.add(choosedelete);
    pathpanel.setBorder(BorderFactory.createTitledBorder("Path to File"));
    pathpanel.add(pathtofile);
    f.setSize(new Dimension(650, 400));
    f.setBackground(Color.white);
    f.setResizable(true);
    ippanel.setBorder(BorderFactory.createTitledBorder("SAVSE IP Address"));
    ippanel.add(iptext);
    outputpanel.setBorder(BorderFactory.createTitledBorder("OUTPUT"));
    outputpanel.add(outputarea);
    portpanel.setBorder(BorderFactory.createTitledBorder("ICAP Port"));
    portpanel.add(porttext);
    // outpathpanel.setBorder(BorderFactory.createTitledBorder("Path to Repair File"));
    // outpathpanel.add(pathtooutfile);
    lpanel.add(ippanel);
    rpanel.add(outputpanel);
    lpanel.add(portpanel);
    lpanel.add(buttonpanel);
    lpanel.add(pathpanel);
    // lpanel.add(outpathpanel);
    lpanel.add(filechooser);
    lpanel.add(scanbutton);
    f.add(lpanel);
    f.add(rpanel);
    f.setVisible(true);
    public static void main(String[] args) {
    clienttester g = new clienttester();
    g.display();
    d)     my2.java – This is the class file I wrote to test that I am able to send a file and scan it and see the output in the JDEVELOPER. In this case the file is stored on the filesystem of the client machine. JDEVELOPER should be able to see the file.
    NOTE:
    “EICAR.com” is the test file downloaded from Symantec site to test a non malicious virus file. I n order to be able to test it like this, the Antivirus program running on your machine should be disabled, or else Antivirus will kick in and delete the file. In the first place you will not be able to download the test virus file either with anti virus running on the machine you are downloading to.
    package com.av;
    import java.io.*;
    public class my2 {
    static int my_return = 0;
    * @param fileBytes
    * @param fileName
    * @return
    public static int scanfile(String fileName){
    String avMode = "SCAN";
    boolean scan = avMode.startsWith("SCAN");
    String avServer = "xx";--avserver ip address
    int avPort = 1344;
    int the_return = 0;
    if (scan) {
    AVClient avc = new AVClient(avServer,avPort,avMode);
    the_return = avc.scanfile(fileName);
    if (the_return == -1) {
    return (the_return);
    } else
    return (the_return);
    //my_return = the_return;
    return (the_return);
    public static void main(String[] args) throws Exception {
    System.out.println("Hi there in Main");
    byte[] b1 = new byte[4];
    b1[1] = 68;
    my_return = scanfile("c:\\eicar.com");
    System.out.println(my_return);
    e)     Then finally we have my1.JAVA, which takes the filename, and it’s contents in the bytes form and scans the file. The reason for this method is we are not storing the file on the filesystem, it is read into the memory and only if it is clean, it is put into the database or else notify the user.
    package com.av;
    import java.io.*;
    public class my1 {
    static int my_return = 0;
    static int a_length = 0;
    * @param fileBytes
    * @param fileName
    * @return
    public static int scanfile(String fileName,byte[] fileBytes) throws IOException {
    String avMode = "SCAN";
    boolean scan = avMode.startsWith("SCAN");
    String avServer = "xxx";--avserver’s ip address
    int avPort = 1344;
    int the_return = 0;
    if (scan) {
    AVClient avc = new AVClient(avServer,avPort,avMode);
    // File file = new File(fileName) ;
    //byte[] fBytes = getBytesFromFile(file);
    the_return = avc.scanfile(fileName, fileBytes);
    if (the_return == -1) {
    return (the_return);
    } else
    {return (the_return);}
    my_return = the_return;
    return (the_return);
    // Returns the contents of the file in a byte array.
    * @param file
    * @return
    * @throws IOException
    public static byte[] getBytesFromFile(File file) throws IOException {
    InputStream is = new FileInputStream(file);
    // Get the size of the file
    long length = file.length();
    // You cannot create an array using a long type.
    // It needs to be an int type.
    // Before converting to an int type, check
    // to ensure that file is not larger than Integer.MAX_VALUE.
    if (length > Integer.MAX_VALUE) {
    // File is too large
    // Create the byte array to hold the data
    byte[] bytes = new byte[(int)length];
    // Read in the bytes
    int offset = 0;
    int numRead = 0;
    while (offset < bytes.length
    && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
    offset += numRead;
    // Ensure all the bytes have been read in
    if (offset < bytes.length) {
    throw new IOException("Could not completely read file "+file.getName());
    // Close the input stream and return bytes
    is.close();
    return bytes;
    // public static void main(String[] args) throws Exception {
    //System.out.println("Hi there in Main");
    // File file = new File() ;
    // byte[] b1 = getBytesFromFile(file);
    //System.out.println(b1);
    // my_return = scanfile(,b1);
    //System.out.println(my_return); }
    Finally , you have the exceptions file,
    e) package com.av;
    public class VirusException
    extends Exception {
    public VirusException() {
    super();
    public VirusException(String text) {
    super(text);
    Once you have all these classes, you can use JDEVELOPER , to load these classes into the database: This is as follows:
    Right click on the project, which has all these classes.
    NEW -> deployment profiles -> load java and stored procedures.
    When you are created deployment profile, you have to specify,
    Loadjava options.
    -f, -v (check the check boxes)
    Under privileges:
    -s – specify database schema these classes are loaded into
    -s – create sysnonym check box
    -g – grant to public or any specific users per your policy.
    Under Resolver,
    -r and –o (check the check boxes)
    I accepted the default name storedproc1. Then you right click on the storedproc1.deploy, deploy to whichever database connection you created.
    And then, In order to access this java class we need a pl/sql wrapper as follows:
    create or replace package my1 is
    function mycheck (pfilename in varchar2, psize in number)
    return number;
    end my1;
    create or replace package body my1 is
         function mycheck (pfilename in varchar2, psize in number)
    return number is
    language java
         name 'com.av.my1.scanfile(java.lang.String, byte[]) return int';
         end my1;
    And the code is invoked from sql plus as follows:
    Select my1.mycheck(“filename”, “filebytes”) from dual;
    One important catch in the above method is to send the filename and filecontents in bytes form. In order to send the file contents as filebytes, you will need another java class and load into the data base as described above.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    * This program demonstrates how to read a file into a byte array. This method
    * reads the entire contents of the file into a byte array.
    * @version 1.0
    * @author Jeffrey M. Hunter ([email protected])
    * @author http://www.idevelopment.info
    public class ReadFileIntoByteArray {
    * method to convert a byte to a hex string.
    * @param data the byte to convert
    * @return String the converted byte
    public static String byteToHex(byte data) {
    StringBuffer buf = new StringBuffer();
    buf.append(toHexChar((data >>> 4) & 0x0F));
    buf.append(toHexChar(data & 0x0F));
    return buf.toString();
    * Convenience method to convert an int to a hex char.
    * @param i the int to convert
    * @return char the converted char
    public static char toHexChar(int i) {
    if ((0 <= i) && (i <= 9)) {
    return (char) ('0' + i);
    } else {
    return (char) ('a' + (i - 10));
    * Returns the contents of the file in a byte array
    * @param file File this method should read
    * @return byte[] Returns a byte[] array of the contents of the file
    private static byte[] getBytesFromFile(File file) throws IOException {
    InputStream is = new FileInputStream(file);
    System.out.println("\nDEBUG: FileInputStream is " + file);
    // Get the size of the file
    long length = file.length();
    System.out.println("DEBUG: Length of " + file + " is " + length + "\n");
    * You cannot create an array using a long type. It needs to be an int
    * type. Before converting to an int type, check to ensure that file is
    * not loarger than Integer.MAX_VALUE;
    if (length > Integer.MAX_VALUE) {
    System.out.println("File is too large to process");
    return null;
    // Create the byte array to hold the data
    byte[] bytes = new byte[(int)length];
    // Read in the bytes
    int offset = 0;
    int numRead = 0;
    while ( (offset < bytes.length)
    ( (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) ) {
    offset += numRead;
    // Ensure all the bytes have been read in
    if (offset < bytes.length) {
    throw new IOException("Could not completely read file " + file.getName());
    is.close();
    return bytes;
    * @param filename
    public static byte[] chk_file(String filename) {
    byte[] fileArray = null;
    try {
    fileArray = getBytesFromFile(new File( filename));
    } catch (IOException e) {
    e.printStackTrace();
    if (fileArray != null) {
    for (int i=0; i<fileArray.length; i++) {
    System.out.println(
    "fileArray[" + i + "] = " +
    ((int)fileArray[i] < 9 ? " " : "") +
    ( ((int)fileArray[i] > 9 && (int)fileArray[i] <= 99) ? " " : "") +
    fileArray[i] + " : " +
    " HEX=(0x" + byteToHex(fileArray) + ") : " +
    " charValue=(" + (char)fileArray[i] + ")");
    return fileArray;
    * Sole entry point to the class and application.
    * @param args Array of String arguments.
    public static void main(String[] args) {
    byte[] fileArray = null;
    try {
    fileArray = getBytesFromFile(new File("c:\\eicar.com"));
    } catch (IOException e) {
    e.printStackTrace();
    if (fileArray != null) {
    for (int i=0; i<fileArray.length; i++) {
    System.out.println(
    "fileArray[" + i + "] = " +
    ((int)fileArray[i] < 9 ? " " : "") +
    ( ((int)fileArray[i] > 9 && (int)fileArray[i] <= 99) ? " " : "") +
    fileArray[i] + " : " +
    " HEX=(0x" + byteToHex(fileArray[i]) + ") : " +
    " charValue=(" + (char)fileArray[i] + ")");
    Having main method helps you to run the file in JDEVELOPER or using JAVA.
    DO not forget to load this class into the database.
    And you create the pl/sql wrapper again as follows:
    create or replace FUNCTION TOBY (pfilename in varchar2) RETURN VARCHAR2 iS
    language java name
    'ReadFileIntoByteArray.chk_file(java.lang.String) return byte[]';
    And you call the function from sqlplus as follows:
    Sql>Set serveroutput on size 20000;
    Sql> call dbms_java.set_output(20000);
    Sql> Select toby(“filename”) from dual; --
    this file should be accessible, I mean you will not be able to send a file on your pc, from sql plus as sql/plus is running on your db server.
    You will be able to see the output in sql plus:
    If you are running it from the APEX:
    When we use file browser widget from APEX, the file is stored in APEX_APPLICATION_FILES table. And we retrieve that into a variable and pass this variable to the function as follows:
    DECLARE
    scan_failed EXCEPTION;
    x varchar2(400);
    z number;
    BEGIN
    select filename into x from wwv_flow_files where name = :P1_FILE_NAME;
    select my1.mycheck(x,toby(x)) into z from dual;
    if z = 0 then
    :P1_SUBJECT:= 'PASSED';
    else
    :P1_SUBJECT:= 'FAILED';
    end if;
    :P1_SCAN_RESULT := '** Scanning File **';
    IF UPPER(:P1_SUBJECT) = 'PASSED' THEN
    BEGIN
    :P1_SCAN_FLAG := 'PASSED';
    :P1_SCAN_RESULT := :P1_SCAN_RESULT || ' ** File passed scan **';
    END;
    ELSIF UPPER(:P1_SUBJECT) = 'FAILED' THEN
    BEGIN
    :P1_SCAN_FLAG := 'FAILED';
    :P1_SCAN_RESULT := :P1_SCAN_RESULT || ' ** File failed scan **';
    END;
    ELSE
    BEGIN
    :P1_SCAN_FLAG := 'UNKNOWN';
    :P1_SCAN_RESULT := :P1_SCAN_RESULT || ' ** Scan Is Not Conclussive **';
    END;
    END IF;
    --IF :P1_SCAN_FLAG = 'FAILED'
    -- THEN RAISE scan_failed;
    --END IF;
    EXCEPTION
    WHEN OTHERS THEN
    DELETE from APEX_APPLICATION_FILES WHERE name = :P1_FILE_NAME;
    RAISE_APPLICATION_ERROR (-20000, 'seb OTHERS error encountered - file upload not allowed. Possible virus detected !');
    raise;
    END;
    ACKNOWLEDMENTS:
    1) JOHN SCOTT – who suggested this ICAP API in one of the threads which is my initial starting point in this direction.
    2) VLAD KOFMAN who wrote the article on WWW.DEVELOPER.com
    3) Mr. KIRAN –One of the engineers from Metalink, who helped me at every step of getting this java programs and pl/sql wrappers working. But for him, I would have not completed my project.

Maybe you are looking for

  • Imac shutting down randomly

    I have a 2011 IMAC operating on 10.9.5 with 16 G memory that will randomly just shut down on me. Before it does, it will make a skipping noise, freeze and then shut down. I am a photographer and am always on Photoshop or Lightroom.  What could this b

  • T500 - - Fn + Spacebar - Full Screen Magnifer

    How does this feature work? I currently have an external 19" monitor designated as the primary display, and the laptop 15" as the secondary. When selecting Fn + Spacebar, a window displays that asks: "Woud you like to move the active window from your

  • 'create table..' statement behaves differently when alone or in a SP

    hello sorry for the title, I just couldnt think of a better description of the problem in very few words... the problem I have is: I created a stored procedure into the oracle db, and this procedure has the following code inside it: auxsql := 'create

  • Black text out in Adobe Reader X and make it uneditable?

    I want to be able to black out certain text lines from some PDFs and then send the PDFs to people without them being able to remove the blacked out bars.  I do not want them to see the text that is being blacked out.  Is there anyway to do this withi

  • Moving my music to my ipad from my computer.  just purchased imatch

    moving my music to my ipad from my computer.  just purchased imatch.  please help!!!