ServerSession in FBS  (otn sample code)

I download FBS OTN sample code which version
use Toplink for manage persistence..
I have notice about some class that hold
ServerSession as it member variable
such as
////////////// FBS
package oracle.otnsamples.ibfbs.trademanagement.helper;
public class StockRateHelper {
// Toplink Server session
private ServerSession server = null;
public StockRateHelper()
throws TradeManagementEventException{
try {
// Initialize ServerSession from session.xml
server = (ServerSession) SessionManager.getManager().getSession(new XMLLoader(),
"FBSServerSession",
Thread.currentThread().getContextClassLoader());
}catch(DatabaseException dbEx) {
throw new TradeManagementEventException(" Error initializing Server Session :"+dbEx);
public void loadRates(Collection stockRates)
throws DatabaseException {
// Initialize client session
ClientSession client = server.acquireClientSession();
// Enable batch-writing [ Write Optimization ]
client.getLogin().useBatchWriting();
// Sequence pre-allocation has been enabled in project.xml with size of 50
// Get a transaction
UnitOfWork uow = client.acquireUnitOfWork();
// Register the objects with transaction
uow.registerAllObjects(stockRates);
// Commit
uow.commit();
I can deploy and run this sample (after spend a moment
for fix database schema) on OC4J10g developer preview
I have some Question
- why ServerSession not need to login before it provide ClientSession
- I don't see code for disconnect (logout) from DB , does it cause resource leak ?
thank you

Hi,
why ServerSession not need to login before it provide ClientSession.When we use SessionManager to retrieve sessions, in the call to getSession(), if the session is not already in the session manager's in-memory cache of sessions, the session manager creates the session and logs in. Hence we don't have to login explicitly( when using SessionMananger).
To open Session with No Login
SessionManager manager = SessionManager.getManager();
Session session = manager.getSession( new XMLLoader(), // XML Loader (sessions.xml file)
                                          "mysession", // session name
                YourApplicationClass.getClassLoader(), // classloader
                                                false, // log in session
                                               false); // refresh session
I don't see code for disconnect (logout) from DB , does it cause resource leak ?When using a three-tier architecture ( Sever-Client Session ), the client session is used to perform all operations. The client forwards all the request to the server session, which either operates on the cache or the database ( if the data is not present in the cache) . Hence the sever session is the entity that takes care of managing database resources and it has the intelligence built-in to manage the connections and resources. We don't have to worry about that. Finally when the
application goes down, we must take care of closing the server session.
We hav't explicitly closed the sever session in this application. If you require to close the server session and not
depend on the timeout mechanism, you can explicitly close the connection when the application is destroyed.
LoadDataServletCtxLsnr.java
public void contextDestroyed(ServletContextEvent sce) {
    // Close server session
I have notice about some class that hold ServerSession as it member variableAll the classes point to the same instance of SeverSession and they don't have seperate instances. There can be only one seversession for an application. The ServerSession instance is got from the Sigleton class SessionManager which manages the ServerSession.
HTH.
Regards
Elango.

Similar Messages

  • What does it take to run OTN sample code?

    Do I have to install some kind of developers tool kit in order to compile and run the OTN and Oracle-install related sample code?
    Also, I noticed that OTN only has toolkits for Oracle 9i, and nothing for Oracle 8i. Is Oracle abandoning 8i? Lots of us are not moving to 9i for some time, and abandoning 8i is not a swift idea. If we can not do what we need to do in 8i, we can always use Microsoft SQL Server, which we already have and are familiar with . . . There are those in the department that are using this to argue for a return to SQL Server.

    I re-read my posting, looking for any mention of a lack of Oracle 8i documents and could not find any.
    But I did notice that I mentioned OTN Samples and a question regarding the need to install toolkits in order to run them. I still don't know the answer. You see, the OTN sample readme files seem quite 'lean', and the classpath info needed to compile the Java code is not provided. I have not been able to compile the code after quite a bit of effort, prompting me to question the need for a tool kit. Or perhaps some .jar or .zip files are missing?
    I also questioned support for Oracle 8i in that OTN is featuring 9i almost exclusively. This was prompted by my inability to locate 8i toolkit downloads in case I needed them. Plus the fact that we will be on 8i until next year . . .
    Have a nice day.

  • OTN Sample HOW- TO's

    hi,
    a lot of people seem to be having problems
    getting oracle otns samples to work correctly
    this is mostly due to newer releases of eg
    xsql which are not documented in the sample
    or as is the case many users do not have
    the same setup as the otn people do.
    not to detract from the excellent work robert
    & the others are doing @ otn
    please keep this thread alive as an ongoing
    forum for otn sample work arounds & to make
    it easier for people to get their samples
    working
    thanx
    pete
    anyone want to post a detailed how to
    for flight finder ??
    null

    Hi,
    I have an example of OTN sample code for XML
    that doesn't seem to work: the program XSLTransform
    at http://technet.oracle.com/tech/xml/parser_java2/index.htm
    will not compile because the method createURL(java.lang.String)
    cannot be found. I cannot find this method anywhere in Oracle's documentation or libraries, in the W3C specs, or in Java.
    If someone at Oracle could clear this up I'd sure appreciate it...
    Thanks,
    Rick

  • How to print a report on local/network printer(Sample Code)

    Hi forms Gurus,
    I'm looking for sample code witch allow to print report on local/network printer from Forms builder.
    Plz help! it's very important.
    TYAG.

    Armand,
    for Forms and Reports 9i, the only chance is to configure the printer as a network printer that is accessible to the Reports Server. In this case pass the printer's network name as desname and destype=printer as the Reports destination (e.g. desname=\network\printername destype=printer).
    Alterantively, there exist an unsupported utility orarrp that you can get from the otn.oracle.com/products/forms web page.
    Frank

  • Look for JDeveloper Tutorial with samples code

    Hello All ,
    my name is Ron ,
    i'm new user of JDeveloper i'm looking for a place to start a tutorial "How to use
    the JDeveloper ? " with samples code .
    from very basic use ( Hello world program ) to addvanced programming ( Like GUI Forms and Database )
    please show me links where to start learning from
    thanks in advance

    The tutorials in the JDeveloper help system are a very good place to start. Choose Help | Help Topics from the JDeveloper menu then click the Tutorials book in the Help navigator. The tutorials are also available on OTN, see:
    http://otn.oracle.com:8877/jdeveloper/help/
    You may also find the 'how to' documents and samples on OTN helpful:
    Oracle9i JDeveloper How To Documents
    http://otn.oracle.com/products/jdev/howtos/content.html
    Oracle9i JDeveloper Sample Code
    http://otn.oracle.com/sample_code/products/jdev/content.html
    Hope this helps.
    - jon

  • New cluster sample code

    Hello,
    There is a new cluster sample code under the sample code directory.
    Description:
    Giving a new collection of documents or a document hitlist from a new query, it will be more efficient for
    users to known what is in the collection by organizing the collection based on the document sementics. To
    partition a collection is the task of clustering. Here is an implementation and sample code of clustering
    based on Oracle Text.
    http://otn.oracle.com/sample_code/products/text/htdocs/cluster.html

    You'll find all the details you need to accomplish this in the ADF Developer's Guide for Forms/4GL Developers on the ADF Learning Center at http://www.oracle.com/technology/products/adf/learnadf.html.
    Section "8.3 Adding a Custom Service Method" explains how to add a service method to your application module.
    Section "7.8.3 Example of Creating a New Service Request" shows the code required to create a new row in a view object.
    Then you would just use the setAttribute() method on the target row to set the desired attributes to the new values based on the values from the source row.
    Section "8.4.1 How to Publish Custom Service Methods to Clients" describes how you would publish your service method to clients.
    Section "10.3.3 How the Data Model and Service Methods Appear in the Data Control Palette" describes where to look to see your published client methods in the data control palette to drop them as a button on a page.
    Section "4.5 Understanding the Active Data Model" explains why the UI will automatically refresh to display the changes you've made in your application module method when it's invoked.

  • How can I install the sample code in my pc?

    I have installed Oracle 8.17 on my pc, my operating system is Win2000. But now I cannot install the sample code on OTN. the requirement is winNT, is that the problem? I think Win2000 should be okay. Who can give me some advice, thank you in advance!!!

    Do what Ethmoid mentioned:  publish your site to a folder on your hard drive and open the html file with a text or html editor like the free TextWrangler.   That's the only way to view or edit the code created by iWeb when it publishes the website.
    However, there is a website design application, Flux, that can open a published iWeb site and view the code and webpage simultaneously.
    OT

  • Oracle Sample code table structure needed ...........

    Hi,
    I have downloaded sample code from oracle web site for connection pooling in java.
    some tables were used in that program like AVAILABLE_ROOM_TYPES, hotel_bookings etc....
    it was told that the table structures can be found in otn site. but i cud not find that.
    can ay one tell me where i can find all the table structures and dumps with data for those tables that are used in all the sample codes available for download.
    thanx in advance
    saro

    Saro,
    You can get it here : http://technet.oracle.com/sample_code/tech/java/travel/travelschema.htm
    Cheers,
    Srinivas.

  • Cannot find sample code: how-to-jazn.war/jar

    Hi,
    As referenced in this online article
    http://otn.oracle.com/tech/java/oc4j/htdocs/how-to-jazn.html I cannot find where this sample code is located. Does anyone know where this is?
    Thanks

    Find it here
    http://download.oracle.com/otn/java/oc4j/how-to-jazn.zip
    Chandar

  • Cant acess the sample code

    I am not able to acess the sourcefiles on the page
    http://otn.oracle.com/sample_code/tech/java/jsp/htdocs/jspdemo/jspdemosrc.html
    Any help on this would be appreciated.
    Thanks

    Hi Asha,
    The page you are referring to was with respect to a older version of the JSP sample code. Please refer to the updated samples at the location: http://otn.oracle.com/sample_code/tech/java/jsps/ojsp/content.html
    These samples are certified against Oracle9iAS Containers for J2EE(OC4J). You can download the JAR file(OjspSamples.jar) from this page and deploy the EAR file in it with OC4J. The Install.html file in the JAR file has instructions to setup the samples with OC4J. Once setup, all the source files can be accessed through the application pages itself. Hope that helps.
    Regards,
    Srinivas
    OTN Team.

  • How can I get the sample code for crawler plugins?

    Hi,
    One SES document mentioned that there are three sample crawler plugins, which reside in $ORACLE_HOME/search/sample/agent. However, I couldn't find them. Did I miss installing something? Can anyone share with me the sample code?
    Thanks.
    Jun Gao

    The original 10.1.6 sample plugins are no longer distributed in 10.1.8.1 as there were a few problems with them. I would suggest you take a look at
    Simple File Crawler
    http://www.oracle.com/technology/products/oses/pdf/Buidling_Custom_CrawlersJan12_07.doc
    Sourcecode here:
    http://www.oracle.com/technology/products/oses/files/simplefilecrawlerpluginmanager.java
    and here
    http://www.oracle.com/technology/products/oses/files/simplefilecrawlerplugin.java
    And the two crawlers under "Sample Code" on the OTN page:
    http://www.oracle.com/technology/products/oses/index.html

  • Methods in SSOEnablerUtil class does not match the sample code

    Hi,
    Please refer to the sample code at:
    http://otn.oracle.com/sample_code/products/iportal/htdocs/sso/ssoover.html
    This mentions that the bakeAppCookie() and unbakeAppCookie() are methods in the SSOEnablerUtil class. I have downloaded iAS 9.0.2 from OTN.
    The SSOEnablerUtil class does not have the above mentioned methods. Are these methods similar to the encryptCookie() and decryptCookie() methods in the SSOEnabler class?
    Please do let me know.
    Thanks,
    Rashmi.

    This was a part of the old package.

  • Workshop Sample Code Download

    I just joined an Oracle Developer Days workshop which name is "Best Practices for J2ee Development". On the workshop, I was told that I can download all the source code for the lab from otn. But I can't find them. Please tell me.
    Thanks in advance.

    This is actually the ODP forum not the OLE DB forum, but anyway I managed to find the sample with no difficulties.
    - Simply go to the OLE DB technology page (http://www.oracle.com/technology/tech/windows/ole_db/index.html)
    - Click on "Sample Code" on the right-hand side in the "Table of Contents" box
    - Click the Oracle Provider for OLE DB 9.2 Samples link
    - Click the Download Now link under the Populate DataSet with Multiple REF Cursors Sample
    Good luck,
    Mark
    ===================================================
    Mark A. Williams
    Oracle DBA
    Author, Professional .NET Oracle Programming
    http://www.apress.com/book/bookDisplay.html?bID=378

  • Posting sample code on ESI, JESI, invalidation

    If you want to post sample code for ESI or JESI, I strongly
    encourage you do that in the Community Code Services part of OTN.
    Here's the link: http://otncast.otnxchange.oracle.com/ .
    ESI is listed under the XML Technology section on this page. If
    you're an Oracle employee, you should follow the instructions for
    posting "samplecode". If you're a non-Oracle OTN member, then
    please follow instructions for posting "membercode".
    We'd really like to get this CCS thing going for ESI, so all your
    contributions are welcome.
    Cheers!

    Yes - it is useful

  • Any sample code on XML parsing

    Hi,
    I am writing an application that has to read and to generate XML (using schemas). Unfortuantely, I cannot find any sample code on how to do it using the Oracle supplied libraries (packages oracle.xml.* . Can anyone point me to some sample code, documentation or alternative?
    Thanks a lot!

    Hello Bert,
    I didnt get your question very clearly.
    1) Do you want to generate XML using Java classes based on XSD?
    or
    2) You want to parse XML that has a XSD specified with it?
    For both these thing, we have sample codes. For the first option, there are Class Generators that does this for you. There are some samples provided with the XDK download. Look into the folder <xdk_home>xdk\demo\java\classgen.
    For option 2, there are many samples on OTN itself. To name one.... AQSample downloaded from http://otn.oracle.com/sample_code/tech/dataint/content.html.
    There is a sample with the JDK download also. The folder is <xdk_home>\xdk\demo\java\schema
    Hope this helps.

Maybe you are looking for

  • Cant see my airplay even after swipe up

    I havnt been able to see my airplay icon when I tried to mirror my IPad Air on to the T.V. . I went a purchased a HDMI Adapter for 53$ Apple brand because all I want to do is mirror, no movies and music, just for work and nothing pops up,  even swipe

  • Acrobat 9 - how do you create a dynamic stamp to include the current date (java script)

    I have seen my question multiple places and times but the resolutions provided have not worked for me. I am running Acrobat 9 Pro, cannot run X or XI due to the use of ProSystem fx Engagement. I want to create what I thought would be a simple stamp.

  • IMac Printing debacle

    Just purchased a 17 inch iMac, 2 Ghz Intel, 1GB SDRAM, 10.4.8, Microsoft Office 11.3. I have it linked to my printer via Airport Extreme. My PowerBook and my G4 both print flawlessly to the HP DeskJet 845c via the Airport. The iMac prints, but seems

  • Remove XML Declaration

    Hi, I am transforming some XML using Transformer class. I get the following output: XML Document transformed to: <?xml version="1.0" encoding="UTF-8"?> <VOTBEndpoint schemaVersion="1.00"><a n="id" v="jobmanager.fork" /><a n="Username" v="UserX" /><a

  • Add EmployeeInfo Record via SDK

    Trying to add an EmployeeInfo record with SDK, set First and Last Names which are mandatory fields, but add fails with message saying userid is not set. I need to add records without a userid, does anyone know how?