How to use Application Roles with Entity Framework

How does one call sp_setapprole before a connection used by an Entity Framework object context closes, since the context opens and closes its own connection automatically, as needed? The only relevant event available on a store connection
(DbConnection ) is StateChange , which does not include a
ConnectionState of Closing . Attempting to call
sp_setapprole when ConnectionState is Closed results in, "A severe error occurred on the current command. The results, if any, should be discarded."

Yes, I realize that I need to call sp_setapprole on an open connection and that I can use
ExecuteNonQuery or similar mechanisms. What I need to determine is how to do this
automatically while using the entity framework.
As I mentioned in my initial inquiry, the EF store connection, which is simply a DbConnection under the covers, does not expose an event (such as Closing) that would allow me to invoke
sp_setapprole before a connection is closed. The only close event we are given is
Closed , which is too late to do any good. I'm hoping to avoid burdening our systems with having to manually manage the connection.

Similar Messages

  • How to use Application Designer with virtual box vm's

    hi all,
    I could use some help please.
    I have everthing installed and working on the VMs but now I want to use Application Designer but I must be doing something wrong.
    I installed the Oracle client on windows and created tnsnames.ora. I can't connect to the database from windows to vm.
    I have some questions which might help me fix this.
    The directory that was mentioned to put tnsnames.ora in (C:\app\Mike\product\11.2.0\client_1\network\admin\) was not there so I had to create it. Was that what I was supposed to do or did the install go bad?
    For the windows host file what should the ip addresses be? I used the IP Addresses of the eth1 network interface from both guests which I created.
    As far as the PeopleTools on windows I used PT 8.52 but with no patch will that work even though the VMs are PT 8.52.06? So if I need the patch in order for App Designer to work how can I get the patch I think I need an account to do that. I think it mentions in the OVM doc that they are included somewhere so should I use those instead?

    <strike>With virtualbox vm's I assume that you mean the OVM templates converted to virtualbox.</strike>
    Didn't notice the OVM category :)
    Which Oracle Client installer did your use?
    You could use the following download from MOS for Database 11.2..02 (since Peoplesoft database is also delivered at 11.2.0.2)
    Patch 10098816: 11.2.0.2.0 PATCH SET FOR ORACLE DATABASE SERVER
    From the patch set download only p10098816_112020_platform_4of7.zip, which is your database client. The rest you will not need to be able to use Application Designer and Datamover.
    Once downloaded start the installer and choose option Runtime (do not choose Instant Client or Administrator).
    Now that you have your connectivity, you can start the PIA-AppBatch vm.
    switch to psadm2 user and go to $PS_HOME.
    Here you will find two files
    toolsclient.zip (PeopleTools 8.52, use client only)
    toolspatchvcd.zip (PeopleTools patch 8.52.06, , use client only)
    Copy these files to your windows workstation and install them in that order.
    Copy the tnsnames from the Database vm to your oracle client install dir network\admin dir and you should be ready to start using Application Designer/Datamover.
    For more detailed information see the post from Nicolas:
    http://gasparotto.blogspot.nl/2012/09/psovm-fscm-91-feature-pack-2.html
    http://gasparotto.blogspot.nl/2011/10/peopletools-852-client-installation.html
    Regards,
    Hakan
    Edited by: Hakan Biroglu on Mar 9, 2013 1:23 PM
    Edited by: Hakan Biroglu on Mar 9, 2013 1:30 PM

  • How to use application managed entity manager in EJB?

    I finish reading The EntityManager Interface in JEE tutorial.
    I know I can use container manager entity manager in EJB, but I want to explore how to use application managed entity manager in EJB.
    Can I use application managed entity manager in EJB (container management JTA transaction is used)? Where do I should close entity manager if can?
    The following is an example from JEE tutorial, but didn't find where to calose entity manager. and can I create mutiple EntityManagerFactory objects and Entity Manager objects to use them in a JTA transaction?
    @PersistenceUnit
    EntityManagerFactory emf;
    EntityManager em;
    @Resource
    UserTransaction utx;
    em = emf.createEntityManager();
    try {
      utx.begin();
      em.persist(SomeEntity);
      em.merge(AnotherEntity);
      em.remove(ThirdEntity);
      utx.commit();
    } catch (Exception e) {
      utx.rollback();

    Seems like a very poor example, the whole power of EJBs is to use Container Managed Transactions so you don't NEED to manage the transaction and the entity manager yourself. What you posted is code I would expect in a non-JEE application, or in a piece of code which requires fine-tuned transaction boundaries such as batched data importing logic.
    If I were you I'd research JPA in steps.
    a) learn about JPA as an API outside of the scope of EJBs (recommended reading: the book 'Pro JPA 2')
    b) learn about Container Managed Transactions in EJBs
    c) learn about Bean Managed Transactions in EJBs
    Right now you're rushing into c). I can understand that it raises many question marks at this point.

  • How to use maven project with fusion web application

    hi i have seen the tutoriel of oracle on how to use maven 2 with jdevelopper ,
    but how to integrate it on a fusion web application ???
    Edited by: 922454 on 9 avr. 2012 04:39

    If you have not managed to help yourself out with maven for ADF here is a quick workaround you can try. Invoke ant's ojdeploy task from maven. Refer step-by-step guide here.
    http://maveninjdeveloper.blogspot.in/2012/04/handle-adf-application-maven-ant.html

  • How to use Oracle partitioning with JPA @OneToOne reference?

    Hi!
    A little bit late in the project we have realized that we need to use Oracle partitioning both for performance and admin of the data. (Partitioning by range (month) and after a year we will move the oldest month of data to an archive db)
    We have an object model with an main/root entity "Trans" with @OneToMany and @OneToOne relationships.
    How do we use Oracle partitioning on the @OneToOne relationships?
    (We'd rather not change the model as we already have millions of rows in the db.)
    On the main entity "Trans" we use: partition by range (month) on a date column.
    And on all @OneToMany we use: partition by reference (as they have a primary-foreign key relationship).
    But for the @OneToOne key for the referenced object, the key is placed in the main/source object as the example below:
    @Entity
    public class Employee {
    @Id
    @Column(name="EMP_ID")
    private long id;
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ADDRESS_ID")
    private Address address;
    EMPLOYEE (table)
    EMP_ID FIRSTNAME LASTNAME SALARY ADDRESS_ID
    1 Bob Way 50000 6
    2 Sarah Smith 60000 7
    ADDRESS (table)
    ADDRESS_ID STREET CITY PROVINCE COUNTRY P_CODE
    6 17 Bank St Ottawa ON Canada K2H7Z5
    7 22 Main St Toronto ON Canada     L5H2D5
    From the Oracle documentation: "Reference partitioning allows the partitioning of two tables related to one another by referential constraints. The partitioning key is resolved through an existing parent-child relationship, enforced by enabled and active primary key and foreign key constraints."
    How can we use "partition by reference" on @OneToOne relationsships or are there other solutions?
    Thanks for any advice.
    /Mats

    Crospost! How to use Oracle partitioning with JPA @OneToOne reference?

  • How to use the namespace with a parser?

    I want to use the namespace in my project. For this reason, I use a sample
    from
    http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/sax/7b_pe.html
    http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/dom/5_ns.html
    to test my understanding.
    The slideshow2.dtd refer to the definition in 'xhtml.dtd'. Because in these
    two files, they all use the 'title' as the element names. To solve these
    conflicts, The namespace is used to qualified the one in slideshow2.dtd.
    But the parser still complain that the 'title' in slideshow2.dtd is declared
    more than once.
    I use apache's Xerces.
    I want to know if Xereces realy support namespace spec. now, or how to use
    the namespace with a parser. Can anyone kindly tell me where to find some
    material that demo the use of namespace in Java program.
    Thanks for any help!!!
    #############FILE: slideshow2.dtd ###############
    <?xml version='1.0' encoding='us-ascii'?>
    <!ELEMENT slideshow (slide+)>
    <!ELEMENT slide (title?, item*)>
    <!ENTITY % xhtml SYSTEM "xhtml.dtd">
    %xhtml;
    <!ELEMENT title (#PCDATA)*>
    <!ATTLIST title
    xmlns CDATA #FIXED "http://www.example.com/slideshow"
    >
    <!ELEMENT item (#PCDATA)>
    ##############FILE: xhtml.dtd #########################
    <?xml version='1.0' encoding='us-ascii'?>
    <!ELEMENT html (head)>
    <!ATTLIST html
    xmlns CDATA #FIXED "http://www.example.com/xhtml"
    >
    <!ELEMENT head (title,style*)>
    <!ELEMENT title (#PCDATA)>
    <!ELEMENT style (#PCDATA)>
    #############FILE: slideshow.xml ####################
    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE slideshow SYSTEM "slideshow2.dtd">
    <slideshow>
    <slide>
    <title xmlns="http://www.example.com/slideshow">Wake up to
    products!</title>
    </slide>
    </slideshow>

    I want to use the namespace in my project. For this reason, I use a sample
    from
    http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/sax/7b_pe.html
    http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/dom/5_ns.html
    to test my understanding.
    The slideshow2.dtd refer to the definition in 'xhtml.dtd'. Because in these
    two files, they all use the 'title' as the element names. To solve these
    conflicts, The namespace is used to qualified the one in slideshow2.dtd.
    But the parser still complain that the 'title' in slideshow2.dtd is declared
    more than once.
    I use apache's Xerces.
    I want to know if Xereces realy support namespace spec. now, or how to use
    the namespace with a parser. Can anyone kindly tell me where to find some
    material that demo the use of namespace in Java program.
    Thanks for any help!!!
    #############FILE: slideshow2.dtd ###############
    <?xml version='1.0' encoding='us-ascii'?>
    <!ELEMENT slideshow (slide+)>
    <!ELEMENT slide (title?, item*)>
    <!ENTITY % xhtml SYSTEM "xhtml.dtd">
    %xhtml;
    <!ELEMENT title (#PCDATA)*>
    <!ATTLIST title
    xmlns CDATA #FIXED "http://www.example.com/slideshow"
    >
    <!ELEMENT item (#PCDATA)>
    ##############FILE: xhtml.dtd #########################
    <?xml version='1.0' encoding='us-ascii'?>
    <!ELEMENT html (head)>
    <!ATTLIST html
    xmlns CDATA #FIXED "http://www.example.com/xhtml"
    >
    <!ELEMENT head (title,style*)>
    <!ELEMENT title (#PCDATA)>
    <!ELEMENT style (#PCDATA)>
    #############FILE: slideshow.xml ####################
    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE slideshow SYSTEM "slideshow2.dtd">
    <slideshow>
    <slide>
    <title xmlns="http://www.example.com/slideshow">Wake up to
    products!</title>
    </slide>
    </slideshow>

  • How to use java integrate with ondemand

    Hi All,
    As i'm new to integration, can anyone help me to use java integrate with ondemand that inserts some records in ondemand and deletes some records from ondemand in secheduled interval basis.?
    Thanks in advance..!
    regards
    sowm

    Greetings,
    hi forum...
    how to use Java WebStart with EJB ? examples ?Well, for starters these are complementing, not 'cooperating', technologies. I presume, since EJB's do not - directly, at least - communicate with a web browser, that you intend for "Java WebStart" to somehow invoke an EJB?? Java WebStart is a technology for running client-side (Java) applications from the web browser - perceptively, the application resides on the server, but technically it, like an applet, is downloaded to the client and run there. Unlike an applet, however, it is not constrained by "sandbox" restrictions and does not have to be re-downloaded each time it is invoked - though the process allows for automagically updating the client-side with new versions of the application. ;) So, with this in mind, to "use Java WebStart with EJB" means little more than deploying an EJB client application with Java WebStart as the distribution channel.
    thanks
    minduRegards,
    Tony "Vee Schade" Cook

  • How to use Cinema4D lite with no opening After Effects CC ?

    How to use Cinema4D lite with no opening After Effects CC ?
    Is that possible ?
    Open a 3D object Photoshop-type in After Effects CC (without C4D)
    It is also possible?
    thanks
    xav

    It is as Mylenium says.
    See this page for details such as this:
    "You open the version of CINEMA 4D that is installed with After Effects using the New > MAXON CINEMA 4D File command or the Edit Original command in After Effects. You will not see this version of CINEMA 4D installed in the Start menu on Windows or in the Applications directory on Mac OS."

  • How to use EJB Remote with Netbeans7.0 ?

    I try to create Session Bean in Netbeans 7.0 but when I select Remote then I have to select Java Application in Netbeans. It different from Netbeans 6.8 ,6.9 which in Netbeans6.8, 6.9 not have dropdown for select Java Application when we choose Remote. So I don't know how to use EJB Remote in Netbeans7.0 then I click finish. After that, I create Project is Enterprise Application Client. but in Main.java at this line
    BLSessionRemote obj = (BLSessionRemote)ctx.lookup("TestBean");
    It can't find BLSessionRemote in Session Beans. How to use EJB Remote with Netbeans7.0 ?

    Why don't you ask this question in the Netbeans mailing lists, where it belongs. Come here when you have problems with code you wrote yourself.

  • How to use Java WebStart with EJB ?

    hi forum...
    how to use Java WebStart with EJB ? examples ?
    thanks
    mindu

    Greetings,
    hi forum...
    how to use Java WebStart with EJB ? examples ?Well, for starters these are complementing, not 'cooperating', technologies. I presume, since EJB's do not - directly, at least - communicate with a web browser, that you intend for "Java WebStart" to somehow invoke an EJB?? Java WebStart is a technology for running client-side (Java) applications from the web browser - perceptively, the application resides on the server, but technically it, like an applet, is downloaded to the client and run there. Unlike an applet, however, it is not constrained by "sandbox" restrictions and does not have to be re-downloaded each time it is invoked - though the process allows for automagically updating the client-side with new versions of the application. ;) So, with this in mind, to "use Java WebStart with EJB" means little more than deploying an EJB client application with Java WebStart as the distribution channel.
    thanks
    minduRegards,
    Tony "Vee Schade" Cook

  • How To  use fckeditor HTML with  flex

    I am using coldfusion server technlogy.
    I am trying make demo site Flex with coldfusion.
    I want to know how to use html code with my mxml application.
    Privious i am using FCK TEXT editor with my HTML File
    Currently flex have small text editor But i need full text
    editor with all feture which include FCK Editor
    Please let me know how to integrate Fck Editor with flex
    application . Or any html file with Flex Application

    Flex has a very limited support for HTML, thus you cannot
    create a full featured editor within flex. The only work arounds I
    have seen are done using IFRAME's over your app.
    Not sure if it an option, however Apollo does a good job of
    addressing this issue by allowing full feature Javascript and HTML.
    Allen

  • How to use crystal report with php

    Hello every body
    can any body know how to use crystal report with php any helping material, code or tutorial for my problem ill be very thankful for helping me
    farooq

    Hello sir
    i am sudeep and i need to deploy crstal reports in php
    i want to integrate it in sugar crm (open source project(
    can u plz tell me how to do it
    i have written this code
    <?php
    //echo phpinfo();exit;
    $ObjectFactory= New COM("CrystalReports11.ObjectFactory.1");
    $crapp = $ObjectFactory->CreateObject("CrystalDesignRunTime.Application");
    //$crapp = new COM("CrystalRuntime.Application.10");
    $reportToRun="C:\Report4.rpt";
    $creport = $crapp->OpenReport($reportToRun, 1);
    //reportToRun=full path to *.rpt file
    $creport->Database->Tables->
    Item(1)->ConnectionProperties['User ID'] = $user;
    $creport->Database->Tables->
    Item(1)->ConnectionProperties['Password'] = $pass;
    //fomatType = integer 22=xls, 31=pdf etc
    $creport->ExportOptions->FormatType = $formatType;
    //type 1 is to output to a file I think 2 is email
    $creport->ExportOptions->DestinationType = 1;
    //location = full path to report output file
    $creport->ExportOptions->DiskFileName = $location;
    $creport->DiscardSavedData();
    $creport->Export(False);
    ?>
    thanks in advance

  • How to use jre6-compat with libreoffice?

    How to use jre6-compat with libreoffice?
    libreoffice + language tool is a sluggish duo when used with jre7, so I have installed jre6-compat in addition to jre7, but I have no idea how to make libreoffice use jre6 from jre6-compat. Jre6 is not listed in Tools>Options>Java.
    I want to keep jre7, because it works well with the other applications.
    [root@goldenfall-archpts1 kuba]# java -version
    java version "1.7.0_09"
    OpenJDK Runtime Environment (IcedTea7 2.3.3) (ArchLinux build 7.u9_2.3.3-1-x86_64)
    OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
    Please advise (in simple terms).
    Last edited by kuba_66 (2013-01-04 05:48:03)

    https://bugs.archlinux.org/task/31812
    No solution so far. But I have no strong interest to fix it. Java7 will soon be the only one in our repos.

  • How to use application.getRealPath()

    Hi all,
    I need to retrieve a document which is external to .war file and with in the same server location. I dont want to hard code the file location path in my jsp. Is there any other alternative by using getRealPath() method. Pl let me know how to use application.getRealPath() if it makes any sense.
    Hoping to hear from you soon :)

    Say, doc1 is in webapps1 and you want to get its real path in webapps2. For that,
    in webapps2, you can use ServletContext.getContext("/webapps1") method , to get the context of webapps1. Then from this context, you can use context.getRealPath("/doc1") method to get the location of the document doc1.
    Hope this helps.

  • ADFS and SharePoint Integration: How to use ADFS Roles?

    Hello,
    I've successfully integrated SharePoint with ADFS2 and users can login by ADFS. One of the claims mapping in ADFS and SharePoint is SAM-Account-Name->Windows account name.
    Is there any guideline how to grant a permission to an specific role? For example I want to grand read access to an specific list to a specific AD group called "ListReaders"
    A link to an online article explains how to use ADFS Roles in SharePoint would be a great help.
    Thank you,

    Hi Allan,
    According to your description, my understanding is that grant permission to ADFS roles.
    Please refer to “A Fellows” last suggestion to grant permission to ADFS roles in the link below:
    http://social.technet.microsoft.com/Forums/en-US/4d5ee453-1447-4d14-b297-33c27ef2c24d/permissions-using-adfs-roles?forum=sharepointadmin
    More reference:
    http://www.css-security.com/blog/claims-based-authentication-and-authorization-with-adfs-2-0-and-sharepoint-2010/
    Thanks,
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

Maybe you are looking for