How do I create a session with the datasource set in code not sessions.xml

I want to create a session where I specify the J2EE datasource name dynamically in code. Normally, I would hard-code a J2EE datasource name in sessions.xml e.g.
<login>
<datasource>jdbc/MyApplicationDS</datasource>
<platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class>
<uses-external-connection-pool>true</uses-external-connection-pool>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
</login>
However, we don't want to use a hard-coded string "jdbc/MyApplicationDS". We want to be able to set this at runtime.
I found this in the App Developer's Guide:
Configuring an External Connection Pool in Java
To configure the use of an external connection pool in Java:
1. Configure the DataSource on the server.
2. Configure the Login to specify a DataSource and the use of an external connection pool:
login.setConnector(
new JNDIConnector(new InitialContext(), "jdbc/MyApplicationDS"));
login.setUsesExternalConnectionPooling(true);
and this:
Configuring Sessions with the sessions.xml File
OracleAS TopLink provides two ways to preconfigure your sessions: you can export and compile Java source code from the OracleAS TopLink Mapping Workbench, or use the OracleAS TopLink Sessions Editor to build a session configuration file, the sessions.xml file.
It seems like I should export and compile Java code that calls login.setConnector(), but I can't find out any information on how to do this. I looked at the MW user guide and I didn't see anything on this.
I also found this by searching this discussion forum:
To create a server session completely from code given a project you can use,
project.getLogin().setConnector(new JNDIConnector(new InitialContext(), "your-datasource-url"));
project.getLogin().setUserName("");
project.getLogin().setPassword("");
Server server = project.createServerSession();
server.login();
However, I don't know how to get the project.
Thanks,
Vicki

If you are using a sessions.xml file, you can get your project from your session. Ensure that when you access your session from the SessionManager, that you do not have it login.
Session session = SessionManager.getManager().getSession("my-session", false);
session.getProject().setConnector(...);
session.login();
If not using a sessions.xml, you can either read your Project from the XMLProjectReader, or instantiate your Project class directly.

Similar Messages

  • Newbie :  How can i create 2 users with the same name on diff domain name ?

    I have two domains on my server
    exemple1.com
    exemple2.com
    and i want to create one user for each domain with the same name
    [email protected] and [email protected]
    curently i can create one user, and it's the same user for both domains :-/
    how ?
    thanks
    Hète

    I must say. I am equally curious about this. i've played a lot in Communigate and it is easy to do there but how does one do this in apple mail?

  • How can I create a sample with the Flex data?

    Hi mates, I'm thinking about doing some stutter vocals with the ultrabeat so I've got a vocal and I have flexed it in time so it fits well on the song's tempo, the problem is that when I create an audio file of the part of the vocal I want to use on my ultrabeat, it creates an audio file that's not fitted in time.
    How can I create the audio file fitted in time?with the flex info?
    Thanks so much!

    psikonetik wrote:
    How can I create the audio file fitted in time?with the flex info?
    You need to create Apple Loop, REX etc.
    For example select the region that you have already flexed, right click ->Bounce Merge->Bounce Inplace. I will create a new audio track with the bounced Flex work.
    Select the new region and go to Audio menu ->Open in Apple Loop Utility and check "Loop" and other attributes to create an Apple Loop. Save the Apple Loop and close the utility. It's expected that the Apple Loop aif must be created in your Project path folder or have a look at the Audio Bin in Logic where is the aif path.
    Drug the Apple Loop in the Arrange audio track ( or it will create one ) and operate with any tempos.
    !http://img59.imageshack.us/img59/4967/aglogo45.gif!

  • How do I create a logotype with the letters in 2 different colours

    I need help with a logo. I'm trying to create a logo were it's as though a lamp is shining on the type so part of the letters are in 2 different colours.

    Set the type using the point text tool (meaning click then type, not click-drag-release then type). Use two type objects, one for each line.
    Draw the path for the light with the pen tool, fill it with yellow, and move it to the back (Object > Arrange > Send to Back).
    Select the top line of text and the spotlight and go to Object > Clipping Mask > Make.
    Now select just the type objects with the Direct Select tool (white arrow) and fill them with blue.

  • How can I create a mailinglist with the new ipad?

    I want send a email to diffrent persons. In the mailprogramm on the mac is this possible with the right mousclick. But how does this work on the Ipad?

    I'm afraid not. If the list is long, best bet is to get it onto the iPad through Notes or a similar program, and copy &amp; paste the whole list into the email.

  • How can I create a universe with the BO repository tables?

    Hi. I need make a universe with the BO repository tables, in order to get user information .
    But, when I try to insert tables in designer, using a new conecction to BO repository. I can't see tables.
    Someone can help me?

    The CMS repository is organized into both physical and virtual tables. Only the CMS can access the virtual tables, therefore you cannot create a universe on the CMS repository. You can access the CMS repository information through the Enterprise SDK.
    https://www.sdn.sap.com/irj/boc/businessobjects-sdklibrary

  • How can I create a file with the excel file type?

    I work with forms 4.5 and I could create "TEXT_IO.FILE_TYPE", but with this I make a I/O TEXT file not a file with the characteristics from a excel file! Can somebody help me please?!?!?
    Best regards,
    Chris from Portugal

    The extension file must be 'CSV' and not 'CVS'. It's better to separate your items by a ';'
    The HOST command you have to execute after creating the file it's HOST(EXEL_PATH SPACE YOUR_FILE) OR Open the DOS PROMPT and type: Exel your_file_name.

  • How can I create a box with the option of either a check or "N/A"?

    Hi there guys, just a quick question which has been bugging me for days now!
    I have a form in which I need to have a check box, but when the box is not checked I need it to show up as "N/A", is that possible?
    I have tried using a dropdown box instead. Making one of the options a capital "P" and setting the font to Wingdings 2 makes it appear as a check. This however makes it impossible for me to type in "N/A" as the other option because the font is set to Wingdings 2!
    Any help would be greatly appreciated
    I am using Adobe Acrobat X Pro on Windows 7
    Thank you
    Clint

    Have you ever seen a paper form work this way?
    Have you ever seen an electronic form work this way?
    You can have a text field next to the check box that show "N/A" when the check box is not selected.
    Or if you like to do a lot of coding, use a check box and then overlay the check box with a text box to display the "N/A" and you can work out how switch between the 2 fields if one wants to uncheck the item.

  • How can i create a slideshow with the newest version of dreamweaver?

    I am trying to figure out how to create a slideshow but i cannot find any explanations for the new version of Dreamweaver. Can anyone help?

    DW doesn't make slideshows.  You'll need to use a jQuery plugin or a 3rd party commercial Extension.
    Do a web search for:
    jQuery Cycle2
    jQuery WOW Slider
    jQuery Fancybox2
    Primer for using jQuery Plugins
    Alt-Web Design & Publishing: Primer for Using jQuery Plug-Ins
    Nancy O.

  • How do I create a movie with the timecode visually embedded in it?

    I have to create a quick demo movie for a client to review. I would like to embed the timecode visually in the corner so the client can review the movie on a DVD and then make comments relative to the displayed timecode. Is there a way to do this?

    You can try this free filter FCE Timecode Display. It has a few more options than the standard Video/Timecode Reader.
    Make sure to set Type = Absolute Timecode (default); probably you don't need IN/OUT values (uncheck it), but only Current Timecode (default).
    If you logged the reel name you can also display that (check the Reel Name option).
    You can position it anywhere on the screen and define font type, size, and color, and a (semi)transparent band beneath the text.
    Piero

  • How can I create a Report with the Report Generation Toolkit?

    Hi,
    I have installed Labview Report Gerneration Tool for Microsoft Office Version 1.1 and now I want to use MS Office Report Express VI but it need the VI "Dflt Data Dir.vi". I don't have this on my computer, why? Where can I get this VI? Can somebody help me?
    thanks Labprog

    Hello Labprog
    This VI should be located in the file.llb in the folder
    ..\vi.lib\utility. Thus, it is not part of the report generation
    toolkit but of LabVIEW. I am not sure why you are missing that file on
    your PC, maybe you just did not find it because it is hidden in a LLB.
    Maybe this LLB is not part of your LabVIEW package (Base, FDS, PDS).
    Anyway, I'll attatch that little VI, hoping that this is the only one missing.
    Ingo Schumacher
    Systems Engineer Sound&VibrationNational Instruments Germany
    Attachments:
    Dflt Data Dir.vi ‏11 KB

  • How to re-create itunes library with the original itunes library files?

    My harddrive was dying so I brought it in to get it replaced. After the replacement was done, my itunes didn't seem to work properly. All my songs are still in the same folders but the library appeared to be corrupted.  I attempted to reimport the itunes xml file but still no good.
    My question: Is there a way to re-generate a brand new itunes library? All my songs are still intact in \music directory.
    Any help appreciated.

    Hi Limnos,
    Thx for the link. I use the http://support.apple.com/kb/HT1589 within your link and re-import the \music folder. Works like magic.

  • Just got my computer back, reset my itunes and added new music. how can i sync my ipod with the computer as I do not want to erase what I have on my ipod

    Just got my computer back. How can I reset my itunes so it matches my IPod settings? I have my favorites and files on my IPod that I want to keep and when I try to sync it gives me the option to erase and sync with computer. How can I sync without loosing any music or files at all?

    - Transfer iTunes purchases to the computer:
    iTunes Store: Transferring purchases from your iPhone, iPad, or iPod to a computer
    - Transfer other music by using a third-party program like those discussed here:
    Copy music from Ipod to new computer...: Apple Support Communities
    - Make a backup of the iPod by connecting the iPod to the computer.  Right click on the iPod under Devices in iTunes and select Back Up.
    - Restore the iPod from backup

  • How to create a pdf with the correct size?

    Hi there
    How do I create a pdf with the correct size? I created several albums and ordered them. Now I want to backup the album and I know how to create a pdf, but when I choose A5 it's to big, when I create my own size it's not the size it should be. The original (made with iphoto) is a small size album 200x150mm. But when I create my own size (200x150) it shows some white borders.
    Does anybody have some tips ore workarounds?
    Yuri
    Imac
    Iphoto 11 (9.4.2)

    Books are designed for and printed on 8.5 x 11 inch stock, US Letter size.  You shouldn't have to select any size.  While viewing the All Pages mode in the book Control-Click on the page and select Save Book as PDF from the contextual menu. 
    That will create a PDF that iPhoto uses to upload and print.  Not all pages will be the same size as the dust jacket will be present in it's full size, 32.8 inches x 8.91 inches:
    If you want a PDF that's designed for your own printing the type Command+P while viewing the All Pages window.  In the first print window click on the PDF button.  It will present you with a contextual menu where you should select Save as PDF.  That will give you an 8.5 x 11 PDF file with all pages the same size.
    OT

  • How to pass username and password with the portal url

    i want to access portal from my web site. i have created username and password fields in my web page. when submited , my portal page should open. so how to pass username and password with the portal url.

    This is not straightforward; but it is doable.
    First tell us about your portal version; portal 10.1.4 has a slightly different method of doing it and the pre-10g portals were completely different animals.
    And if you are in AS Rel 2, then the most important document for you would probably be the following:
    [Creating Deployment Specific Pages| http://download-west.oracle.com/docs/cd/B14099_19/idmanage.1012/b14078/custom.htm#i1015535]
    You might want to use it in conjunction with some metalink notes about your portal version and such a login page.
    hope that helps!
    AMN

Maybe you are looking for

  • How to turn off voice control with iPhone 5s with iOS 8

    I Dropped my phone in the tub, I have an otterbox on it but it didn't do the phone any good :/. I dried it off and the home button started acting up. And now it doesnt work when i hit it. But the Touch ID still works. However randomly voice control w

  • HT1529 How to find another Apple ID is registered my Product the Serial number.

    How to find another Apple ID is registered my Product the Serial number. my Apple Product cannot register to my Apple ID.

  • Alert error when master database is down

    When the master database is down (server maintenance, offline back up) a lot of error messages appear in the alert.log of the slave database. Is possible to disable registration of error ORA 12012 and related when master database is closed ??

  • What is the best program to create professional slideshows?

    Hi everyone, I'm only using stills. I've just started a trial of (my first Adobe product) Premiere Elements 13. Finding it slower to learn than some easier to use slideshow software I've trialed. I want to be able to hi-light specific sentences in im

  • System landscape information

    Hi, I got an email from support team with few questions on system landscape. If any idea can you please tell me how we can find the following information at SAP GUI level? System landscape: - Is it a Integrated or a external installation ? - What is