Connect dinamically with JPA

Im using Netbeans in a swing project.
I want to connect to database to manage persistence.
I want to use JPA (toplink)
I need to know how to specify dinamically the data base username and password, NOT in the presistence.xml (Persistence unit).
I think i shuld use something like this:
javax.persistence.EntityManager myEntityManager;
HashMap map = new HashMap ();
mapa.put("toplink.jdbc.user","myuser");
mapa.put("toplink.jdbc.password","mypassword");
myEntityManager = javax.persistence.EntityManagerFactory.createEntityManager(map);I get the following error:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 9.1 (Build b36-rc)): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Invalid Arguments in Call Code: 17433
....Any Idea?
Thanks

I have a very similar problem in the glassfish V2 toplink-essentials: (with Java SE non-EJB application in a jar)
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: invalid arguments in call
Error Code: 17433
What the above suggests is that the JDBC URL is accepted instead of the Persistence Unit Name; is it possible that the Map key and value are switched
in the EntityManagerFactory class method createEntityManager(Map){...} ?

Similar Messages

  • JCO Runtime error with JPAAS

    Hi,
    I am currently facing the following issue while using JCO 3
    I use the same code in stand alone java project i can connect to the system using JCO and get the results but the same when i try to use it with JPAAS inside a web application i get the following error.
    Can anyone help me out on what could be the problem?
    here is the stack trace
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: Could not initialize class com.sap.conn.jco.rt.JCoRuntimeFactory
         org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:107)
         org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:323)
         org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
         org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
         org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
         org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
         org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
    root cause
    org.apache.cxf.interceptor.Fault: Could not initialize class com.sap.conn.jco.rt.JCoRuntimeFactory
         org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155)
         org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121)
         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:162)
         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:89)
         org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
         java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
         java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         java.util.concurrent.FutureTask.run(FutureTask.java:138)
         org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
         org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
         org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
         org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
         org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
         org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
         org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
         org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
    root cause
    java.lang.NoClassDefFoundError: Could not initialize class com.sap.conn.jco.rt.JCoRuntimeFactory
         com.sap.conn.jco.rt.RuntimeEnvironment.<init>(RuntimeEnvironment.java:43)
         sun.reflect.GeneratedConstructorAccessor14.newInstance(Unknown Source)
         sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         java.lang.Class.newInstance0(Class.java:355)
         java.lang.Class.newInstance(Class.java:308)
         com.sap.conn.jco.ext.Environment.getInstance(Environment.java:155)
         com.sap.conn.jco.ext.Environment.isDestinationDataProviderRegistered(Environment.java:401)
         com.sap.did.integration.direct.ABAP_System_Connect.<init>(ABAP_System_Connect.java:43)
         com.sap.did.services.impl.IntegrationServiceImpl.getOpenInvoices(IntegrationServiceImpl.java:37)
         com.sap.did.rest.impl.VendorsImpl.getVendorInvoices(VendorsImpl.java:61)
         sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
         org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:162)
         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:89)
         org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
         java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
         java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         java.util.concurrent.FutureTask.run(FutureTask.java:138)
         org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
         org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
         org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
         org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
         org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
         org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
         org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
         org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
    note The full stack trace of the root cause is available in the SAP logs.
    Both the jar file and the dll file are present in the war file and still i get this error.
    Regards,
    Suhas

    I am experiencing exactly the same problems on one of two identical machines after something happened in the registry.
    The first problem that appered was an error 1325 "Favorites is not a valid short name".
    I did find the registry key involved (%userprofile%\Favorites) and fixed it.
    So now the the next one: yours.
    I think the solution can be found in the list of registry keys that Adobe Reader is accessing.
    btw Eusing registry cleaner did not find this key to be in error.
    Problem is that the Reader does not ask for an alternative location after stumbling on the key.
    Who can gnerate a list of keys accessed?

  • About Leveraging database security with JPA...

    I've googled the web but haven't find anything about considering the security as an aspect of the development with JPA and TopLink Essentials as you can integrate VPD with Toplink... http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/dblgcfg008.htm
    What would be the best way to :
    1- Track user's specific behavior
    2- Implement Fine Grained access control
    from the database...
    Even if it's not in the spec... What do you think could be a design pattern to leverage the Oracle database features ?
    Best Regards,
    -Gregory

    Gregory,
    Using VPD with an ORM solution involves two pieces of functionality:
    1. An isolated cache so that entities read from a table using VPD cannot accidentally be accessed by other application threads. TopLink Essentials does support this through is JPA extensions:
    http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-extensions.html
    2. An approach for configuring the user credentials in the connections. Oracle TopLink provides exclusive connections with event call-backs for this as well as proxy authentication support. We do not currently support these options within TopLink Essentials.
    To address #2 using JPA and TopLink Essentials I would need to know more about your architecture. Assuming you are using JPA in EE with session beans and JTA transactions then you could lookup the JDBC connection directly from container within your transaction (prior to your first query requiring JPA) and invoke your VPD user config stored procedure.
    If you would like to work through the specifics of your requirements and then post the final solution back here you can contact me directly: douglas.clarke at oracle.com.
    Doug

  • Configuring JCo3 Connection Pool with single sign on on non SAP Java server

    Hi Everyone,
    i have configured a connection pool on JBoss as per JCo3 Documentation and is working great.
    Now I need help to configure this connection pool with single sign on so that RFc on SAP ECC systems are executed using end users credential rather than using single user name password used to configure JCo connection pool.
    On SAP Java stack I am sure its possible within Java WebDynpro    and i assume using JCA resource adapter. But what if we don't want to use SAP Java App server.
    Any help will be appreciated.
    Thanks,
    Divyakumar Jain

    Eason, 你好!
    I have exactly the same problem.  Did you find a solution to this problem?  If so, please let me know!

  • My iPhone 5 won't let me use my apps until I connect them with iTunes after downloading ios7. Solutions?

    My iPhone 5 won't let me use my apps until I connect them with iTunes after downloading ios7.  There's just a thing that pops up and says that in order to activate banners and push notifications I have to connect the app with iTunes. The thing won't go away no matter how many times I push ok, and it doesn't give me another option. Solutions?

    Oh my gosh I had the EXACT same problem, and for ages I couldn't figure out how to fix it until today. Here's what I did:
    First I went onto my computer, opened itunes, and un-installed tumblr, vine and kik. These were the apps I was having problems with (it said I had them on my phone but, like you, they didn't show).
    Then I went to the itunes store, searched for each one, and it said I could update them so I did (just FYI: for tumblr a window popped up saying "please click ok to confirm you are 17 years or older", so I did that also)
    When I went back to my phone and tried installing them again (still on my computer), it worked!
    I hope this helps, because it was incredibly frustrating. Good luck!

  • "An error occurred accessing your Microsoft SharePoint Foundation site files" connecting site with SharePoint Designer

    I have a SharePoint 2013 environment with 1 AD Server, 1 DB Server and 1 APP Server, with 13 Web Applications running under the SharePoint.
    Recently I rebuilted the application because of some infrasctrucutre problems, and I was able to solve all of them, except one. I can't connect to any of those 13 Web Apps with SharePoint Designer. When I try to connect, it always ask credentials, then it
    seems like loading the site, then the error appears:
    "An error occurred accessing your Microsoft SharePoint Foundation site files. Authors - if you are authoring against
    a Web server, please contact the Webmaster for this server's Web site. WebMasters - please see the server's application event log for more details."
    I've spent hours troubleshooting it, but none of the information I found was valid. I've already tried to clean the cache, but didn't work. I found plenty of related data of this
    error with FrontPage and old versions of SharePoint, but nothing helped. All the Web Apps are SPD-Enabled at Site Collection Administration. I've tried connecting from many different PC's. The 15/LOGS folder doesn't get any data from this error, neither the
    Event Viewer.
    I really don't know what else to do. Please Help!

    I found the answer of my issue was in a .NET Agent installed by NewRelic on the server. I found a connection trouble with Fiddler, then I end up figuring this out:
    This can be the result of Real User Monitoring so the first step in troubleshooting would be to disable it and see how it affects the application. The .Net Agent injects snippets of javascript into the header of pages sent to the users browser to measure the
    page load time on the user's end.
    You can disable RUM by editing newrelic.config and changing this line:
    <browserMonitoring autoInstrument="true"/>
    to this:
    <browserMonitoring autoInstrument="false"/>

  • Connection issues with Safari 3

    I'm having some connection issues with Safari 3.
    When I connect wirelessly, Safari won't load any web pages. I go and use Firefox and everything is just peachy.
    I've reset Safari, emptied the cache and whatnot. I went in and checked the permissions, everything checks out.
    When I connect with Ethernet, there's nothing wrong, which is my dilemma.
    Help would be greatly appreciated.

    There are a number of posts in the Leopard forum from people with direct experience with upgrading from Panther to Leopard. Here is a relevant thread from there that should reassure you.:
    http://discussions.apple.com/thread.jspa?threadID=1418714
    Your system should be fine for Leopard, but you will probably need a current version of Photoshop if you don't already have it. See this download:
    http://www.adobe.com/support/products/pdfs/leopardsupport.pdf
    Also, Leopard doesn't run Classic (OS 9) apps.
    One caveat - first make a bootable backup "clone" of your present system onto an external firewire drive so you can recover if anything goes wrong. You can use the "Restore" tab of Disk Utility to make such a clone, and there are also Panther-compatible versions of Carbon Copy Cloner (v 2.3) and SuperDuper (v 2.1.4), both excellent for this.
    It's even possible to a create second Panther clone on a different external volume to create a "dual-boot" system, using that volume to continue to run old applications that you can't run with Leopard.

  • Connection issues with EA4500

    I had bad connection issues with my mobile device, so i pressed reset on my EA4500 router, and now when i connect to my network, it gives my limited connection even though i have 5 bars of signal. Not sure what to do now...

    Resetting the router will erase all the settings you configured on the router since the initial setup. You manually configure the router's wireless settings so your wireless devices can have internet access again.
    Procedure: http://kb.linksys.com/Linksys/ukp.aspx?vw=1&docid=cfb50c0dc992443ab2405a782cca60f7_19073.xml&pid=80&...
    Make sure to use a computer that is hardwired via Ethernet cable to the router.
    For bad connection issues: http://kb.linksys.com/Linksys/ukp.aspx?vw=1&docid=cf6ed888ce144d06905af4987887fd1b_KBxxxx_EN_v1.xml&...

  • TS3694 hey everyone.. i have a problem with my 3Gs iphone.. i updated to the ios5 and now when i open it says that i have to connect it with the itunes. when i connect it says that has an error 28 something like that.. can anyone help me to fix it?? Regar

    hey everyone.. i have a problem with my 3Gs iphone.. i updated to the ios5 and now when i open it says that i have to connect it with the itunes. when i connect it says that has an error 28 something like that.. can anyone help me to fix it?? Regards

    Error 23, 28, 29: These errors may indicate a hardware issue with your device. Follow the steps in this article. Also attempt to restore while connected with the white USB Dock Connector cable that shipped with your device, on a known good computer and network to isolate this issue to the device. The MAC address being missing or the IMEI being the default value, (00 499901 064000 0), can also confirm a hardware issue. Out-of-date or incorrectly configured security software can also cause these errors.

  • CR2008 connectivity issue with BOE Universes(sap and non sap universes)

    Hi Experts !!
    Recently we tried to build/connect to a Universe in Crystal Reports2008 via 'Make a new connection tab'.
    The universes are of SAP BW or non SAP Lying in BOE Servers and we are trying to build reports on them by conncting/utilizing the universes as a database for Crystal Reporting.
    Our issue is most of the time we are not able to connect to the Universes and the connectivity blows out by some 'communication Error' thing initially.
    While at some other points in time, the connectivity takes us to the Universe and we are able to select few characteristics and key figures from the Universe but the moment we go futher and try to run by pressing 'OK' button it blows out and say' LOGON FAILED'.
    Apparantly, it is an connectivity issue with BOE server and from the different blogs it looks like it is a known issue for long.
    The proposed issue resolution were like either CR2008 should be SP2 with BOE SP3 or there should be some additional .dll files defined in the paths in case of MSSQL database. None of this applies to us as we are on CR2008 with SP3 and going back to SP2 is probably not a viable option for us, and we are using Oracle as underlying database in this specific case.( i would like to tell you here that we are able to connect to Oracle Database directly though).
    We have raised a message with SAP and was just wondering if we do have some solution/workaround already available to this known issue in place please?
    Thanks&Regards.
    Edited by: AMIT GHILDYAL on Aug 1, 2011 2:41 PM
    Edited by: AMIT GHILDYAL on Aug 1, 2011 2:44 PM
    Edited by: AMIT GHILDYAL on Aug 1, 2011 3:14 PM

    Hi Amit,
    Moved to Universe Forum.
    If you have a case logged then no point posting here also, this is a public site and not a case management tool.
    Once you do get the solution from your case please post it here also to help others if they have the same problem.
    Thank you
    Don

  • Hey, my ipad is disabled and i cant open. i tried connecting it with itunes in recovery mode to restore it but it wont work it doesnt show and options itunes doesnt detect my ipad in recovery mode. what do i do know? please help!!!

    Hey, my ipad is disabled and i cant open. i tried connecting it with itunes in recovery mode to restore it but it wont work it doesnt show and options itunes doesnt detect my ipad in recovery mode. what do i do know? please help!!!

    If you followed these instructions and you were unable to enter recovery mode, I'm still leaning toward a hardware problem.  Also, since you have IOS-7, read this.  It might help.

  • 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?

  • Hi, I want to use my Capsule just as a back up via wireless. How do I set this up without connecting it with an ethernet cable to either a router or the iMac??

    Hi, I want to use my Capsule just as a back up via wireless. How do I set this up without connecting it with an ethernet cable to either a router or the iMac??

    I misunderstood what Time Capsule is and had hoped for a wireless backup device that didn't have to be connected to the router.
    The TC is a wireless backup device.. it does not need to be connected to the main router..
    The problem is the computer.. not the TC.. the computer has only one wireless card.. if your current internet is by wireless.. then you must choose.. internet or backup.
    But my other suggestion will work.. get a wireless USB stick compatible with Mac OS.. there are plenty and cheap.. since you are in the same room as the TC they will work fine.. plug it in and load the driver.. taint hard.
    You should do the first backup by ethernet though.. wireless is too slow.. once you have that, you will do fine.
    Search ebay for wireless n usb.. Mac compatible..
    http://www.ebay.com/itm/New-EDUP-Mini-Wireless-11N-300M-USB-LAN-Card-WiFi-Adapte r-Nano-Card-Soft-AP-/150864362939?pt=US_USB_Wi_Fi_Adapters_Dongles&hash=item2320 377dbb#ht_3553wt_1165
    As you can see.. they are getting smaller and neater.
    I have no idea if it works .. haven't tried one.. but I have used USB wireless stick on the Mac to overcome this issue.
    You will need to set static IP .. not hard but you need to set specifics if you do buy one post again for the setup.

  • How can I play music on my macbook pro (OSX Lion) through a Pioneer receiver. I've connected them with a mini display port to HDMI cable with audio support bought at the Apple Store, but there's no sound coming through. thanks

    How can I play music on my macbook pro (OSX Lion) through a Pioneer receiver? I've connected them with a mini display port to HDMI cable with audio support bought at the Apple Store, but there's no sound coming through. There are 4 HDMI-in ports on the receiver - BD, DVD, DVR/BDR and audio. In my system preferences for sound, the receiver doesn't show up as an output option. Can anyone please advise. (ps, this is my first time posting a question, so I hope I can find your answers!) thanks, JP downunder

    For sound, try the audio output port and connecting to the RCA  audio input ports on your Pioneer receiver.  Use something like this:
    http://eshop.macsales.com/item/OWC/PODCONNECTOR/
    Ciao.

  • Hi, I'm using a Mac Pro here. I am trying to connect it with my NAS hard drive. But i could not connect to it because i have an ethernet which connects to the intranet in my company and Air Port for the internet.

    Hi, I'm using a Mac Pro here. I am trying to connect it with my NAS hard drive. But i could not connect to it because i have an ethernet which connects to the intranet in my company and Air Port for the internet and it could not detect the the ip address after i input the correct address on "Connect to Server" window. Please help! Urgent! Thanks

    I did not say it is not possible.
    I said if your company networks are monopolizing both ports, you should talk to them about what options are available.
    Maybe you can get the company Intranet over wireless if you change some configuration items such as Subnet Mask.
    Maybe you can get on the Internet over Ethernet.
    You really need to ask them, and do not let them blow you off because you have a Mac. If they balk, ask them how it would be done on a PC (becasue it will be the same on a Mac).

Maybe you are looking for