How to Use Stateful Database Connections

Formspider 1.9 enables developers to run an application using the same database session for each user session. This enables developers use features of the Oracle Database such as package globals, global temporary tables etc… throughout their application. It also makes migrating Oracle Forms applications (or applications built with any technology assuming a stateful database session) to Formspider much easier and faster.

To enable this feature all a developer needs to do is to call the following API procedure


api_application.setStateful(in_stateful_yn=>'Y');

Starting with the next user event, the application will always use the same database connection.

Similarly, to go back to the stateless mode simply call:


api_application.setStateful(in_stateful_yn=>'N');

We recommend that you start your applications in stateless mode and only allow stateful connections after the user is authenticated. Similarly, we recommend that you switch the application back to the stateless mode if a user logs out.

  • Ilia Sazonov

    Hello,

    I’m getting an error when trying to switch to stateful –

    2015-10-16 14:23:30,700 DEBUG [http-8090-3] co.gerger.bdf.view.BDFServlet: WebSessionId is fjLFCKCW03ZXEPDPSFcY_16-10-2015_14-23-10:456

    2015-10-16 14:23:30,700 INFO [http-8090-3] co.gerger.bdf.db.ConnectionWarden: Creating pyhsical connection using parameters…

    2015-10-16 14:23:30,853 WARN [http-8090-3] co.gerger.bdf.db.ConnectionWarden: Creating pyhsical connection failed.

    java.sql.SQLException: No suitable driver found for @engineSchemaURL@

    at java.sql.DriverManager.getConnection(DriverManager.java:689) ~[na:1.8.0_45]

    at java.sql.DriverManager.getConnection(DriverManager.java:247) ~[na:1.8.0_45]

    at co.gerger.bdf.db.ConnectionWarden.createPyhsicalConnection(ConnectionWarden.java:197) [ConnectionWarden.class:na]

    at co.gerger.bdf.db.ConnectionWarden.createPyhsicalEngineConnection(ConnectionWarden.java:167) [ConnectionWarden.class:na]

    at co.gerger.bdf.db.ConnectionWarden.getEngineConnection(ConnectionWarden.java:134) [ConnectionWarden.class:na]

    at co.gerger.bdf.view.BDFServlet.doPost(BDFServlet.java:185) [BDFServlet.class:na]

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) [servlet-api.jar:na]

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) [servlet-api.jar:na]

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:6.0.29]

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.29]

    at co.gerger.filters.GZIPFilter.doFilter(GZIPFilter.java:48) [GZIPFilter.class:na]

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.29]

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.29]

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.29]

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.29]

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470) [catalina.jar:6.0.29]

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.29]

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [catalina.jar:6.0.29]

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.29]

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) [catalina.jar:6.0.29]

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) [tomcat-coyote.jar:6.0.29]

    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) [tomcat-coyote.jar:6.0.29]

    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) [tomcat-coyote.jar:6.0.29]

    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]

    • http://www.gerger.co Yalim K. Gerger

      Hi Ilia,

      I apologize for the inconvenience. Thank you for the detailed information. We’ll take a look at this ASAP and get back to you.

      Kind Regards,
      Yalim

    • http://www.gerger.co Yalim K. Gerger

      Hi Ilia,

      You need to edit the web.xml file content in the middle tier according to your environment. You can find more information about the solution at this link: http://osqa.theformspider.com/questions/4551/an-error-occurred-please-contact-your-system-administrator

      Kind Regards,
      Yalim

      • Ilia Sazonov

        Thanks, Yalim!
        I still have some questions, and I put them in the discussion you indicated above.