Database Coonection in JDeveloper

Hello,
I'm working with Jdeveloper 10.1.3 ADF Faces.
In my ADF Faces backing bean class I read text File and i must insert it to Oracle DB
Table:
How to use existing connection (for example HRConn) which is already defined in Connections Tab in Jdeveloper?
or I must create a new JDBC Connection in backing bean class like:
Connection conn = null;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection("jdbc:oracle:thin:@db:1521:Oracle", "hr", "hr");
Could you please give some small example.
Thank You in advance.

Whenever you create a DB connection in JDeveloper, it creates a set of DataSources for that connection. You can see them from Tools->Embedded OC4J settings dialog. In this dialog expand the 'Current Workspace -> Data Sources' tree.
The datasources are typically named as 'jdev-connection-managed-XXX' and 'jdev-connection-native-XXX' where XXX is the name of the DB connection e.g. HRConn.
You should be able to refer to these datasources using they jndi names listed in Embedded OC4J settings dialog mentioned above. Somethign like...
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/HRConnDS");
Connection conn = ds.getConnection();
Please note that this will run ONLY when you are running a page in the OC4J(embeded or properly setup oracle app server). This code will not run when you run it as part of a standalone java class.
regards - rutwik

Similar Messages

  • FOD schema installation with tutorial Database Development with JDeveloper

    I followed the instruction online at http://www.oracle.com/technetwork/developer-tools/jdev/index-095536.html to install FOD schema. Errors displayed when call "run ant target -> buildall" were below:
    populateImages:
    [java] 2010-9-26 14:56:01 oracle.as.jmx.framework.LoggerHelper log
    [java] SEVERE: Error initializing the JMX FRamework SPI "oracle.as.jmx.framework.standardmbeans.spi.JMXFrameworkProviderImpl"
    [java] java.lang.reflect.InvocationTargetException
    [java]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [java]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [java]      at java.lang.reflect.Method.invoke(Method.java:597)
    [java]      at oracle.as.jmx.framework.PortableMBeanFactory.initializeSPI(PortableMBeanFactory.java:1895)
    [java]      at oracle.as.jmx.framework.PortableMBeanFactory.initializePlatformSPI(PortableMBeanFactory.java:1851)
    [java]      at oracle.as.jmx.framework.PortableMBeanFactory.init(PortableMBeanFactory.java:1831)
    [java]      at oracle.as.jmx.framework.PortableMBeanFactory.<init>(PortableMBeanFactory.java:207)
    [java]      at oracle.as.jmx.framework.PortableMBeanFactory.<init>(PortableMBeanFactory.java:215)
    [java]      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    [java]      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    [java]      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    [java]      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    [java]      at java.lang.Class.newInstance0(Class.java:355)
    [java]      at java.lang.Class.newInstance(Class.java:308)
    [java]      at oracle.mds.core.MDSInstance.lookupMBeanServer(MDSInstance.java:2061)
    [java]      at oracle.mds.core.MDSInstance.checkMDSDeployStatus(MDSInstance.java:950)
    [java]      at oracle.mds.core.MDSInstance.<init>(MDSInstance.java:1692)
    [java]      at oracle.mds.core.MDSInstance.<init>(MDSInstance.java:1666)
    [java]      at oracle.mds.core.MDSInstance.findAndStoreMDSInstance(MDSInstance.java:1962)
    [java]      at oracle.mds.core.MDSInstance.getOrCreateInstance(MDSInstance.java:507)
    [java]      at oracle.mds.core.MDSInstance.getOrCreateInstance(MDSInstance.java:470)
    [java]      at oracle.adf.share.config.ADFMDSConfig.getDefaultMDSInstance(ADFMDSConfig.java:436)
    [java]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    But still got message - "BUILD SUCCESSFUL" at the end. Does anyone know how to solve this problem?
    My intention of performing FOD schema installation was to follow the tutorial "Database Development with JDeveloper" at http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/databasedevelopment/obe_%20databasedevmt.htm. But I stopped at the last topic "Creating and Debugging PL/SQL Objects in the Database" ->"Running a SQL Script to Create an Object Type" when trying to create a object using script on the page.
    This is the script:
    ------------------------------------------------start
    REM
    REM Create object ORDER_ITEMS_REC
    REM
    CREATE or REPLACE type ORDER_ITEMS_REC as object
    ORDER_ID NUMBER(15),
    LINE_ITEM_ID NUMBER(3),
    PRODUCT_ID NUMBER(15),
    QUANTITY NUMBER(6),
    UNIT_PRICE NUMBER(8,2),
    CREATED_BY VARCHAR2(60),
    CREATION_DATE DATE,
    LAST_UPDATED_BY VARCHAR2(60),
    LAST_UPDATE_DATE DATE,
    OBJECT_VERSION_ID NUMBER(15)
    show errors;
    --------------------------------------------------end
    and the error message I got was
    ------------------------------------------------start
    Error report:
    ORA-01031: insufficient privileges
    01031. 00000 - "insufficient privileges"
    ------------------------------------------------end
    I was wandering whether the error of FOD installation could cause the error of the tutorial?
    Any response will be appreciated.

    1. you dont have to insall Oracle database at the BO machine side, you just need any database to hold the BO repository.
    2. you cant connect directly using BO, only Crystal reports can connect directly to R3 database, you need to have a BW in between.
    extract your data into the BW, and let BO connect to BW using the BO integration kit for SAP solutions.
    3. no you dont have to have 3 different machines, using one BO machine you connect to them all, but you may need build a  BO environment, (Development, Production servers)
    good luck

  • Database development with jdeveloper

    Hi
    Thank you for reading my post
    is it possible to use Jdeveloper to develop Mysql databases ?
    how i use its diagram <> database capabilities to forward a diagram to a mysql database ?
    thanks

    Hi,
    For information on how connect MySQl to JDev, look in the Help for 'Working with Non-Oracle Databases' under 'Using Application Development Tools | Database Tools'.
    And for Modeling Database Development with JDeveloper, you can find this tutorial useful :
    http://www.oracle.com/technology/obe/obe1013jdev/dbdevelopment/obe_%20dbasedevmt.htm
    Regards,
    Sunil..

  • BUG: Database Modeling in JDeveloper 11.1.2.1.0

    Hello,
    I'm defining a foreign key constraint in a database diagram in JDeveloper 11.1.2.1.0 with several columns, and within the Edit Constraint dialog in the Associations list the local columns names does not match the referenced columns names in the grid, although the associations are well defined internally. The same occurs in the Foreign Keys section of the Edit Table dialog, so I would like to know if there is any service pack or something that fixes this,
    Thanks in advance.

    Hi,
    Shay is correct that what you are trying to do requires JDeveloper 12c.
    Frank

  • Database Lite and JDeveloper / ADF

    Hello,
    I'm planning to create a small application which will run on mobile PC in an off-line mode, having synchronization with master DB once connected to the proper network.
    The main architecture on the target PC may be :
    - Oracle Lite
    - GlassFish
    - ADF application
    I downloaded JDeveloper 11.1.1.3.0 and the latest version of Oracle Lite (10.3.0.3).
    I'm looking the tutorials but none of them are talking about the JDeveloper 11g version, they all speak about BC4J/OC4J. Since I'm new to Oracle's product I don't know these "products" (framework ?) and in the 11g version this seems to have disappeared.
    Are those versions compatible with each other ?
    Will the tutorial work ?
    Regards
    PS: the same thread is present on the JDeveloper forum

    The main thread will be the one on JDeveloper section :)
    ==> Database Lite and JDeveloper / ADF

  • Database Connections in Jdeveloper

    Hi,
    I was able to make a successful jdbc to odbc database connection using Jdeveloper 10.1.3.0.2. I could see the list of tables in the Oracle database. However, release 10.1.3.0.4 produces the following message: "Invalid Fetch Size". I also tried a straight jdbc connection in the later release, and it returns a certain amount of metadata, but no list of tables. Why does the connection work for the earlier release but not the later release?
    Thank you,
    Roland Wales

    I logged an er (3649694) to track this request. Thanks for the feedback!
    -- Brian

  • Connect between database oracle and jdeveloper

    i want a simple example to connct database oracle and jdeveloper
    to insert record or update or delete or query

    The easy way: http://www.oracle.com/technology/obe/obe1013jdev/10131/masterdetail_adf_bc/master-detail_pagewith_adf_bc.htm
    Or if you want to hand code JDBC then:
    http://www.oracle.com/pls/db111/to_toc?pathname=appdev.111%2Fb28765%2Ftoc.htm&remark=portal+%28Books%29

  • Database connections in JDeveloper 10g

    I love the integrated database browsing of JDeveloper, but there is one problem with it. When creating new connections you have to supply the user name and password. For security reasons this is not always recommended. It would be better if JDeveloper could prompt me for the user name and password when I try to open a connection. It used to be like this in earlier versions of JDeveloper I think. At least this should happen if no password is stored with the connection. Where security is not a concern I can store a default user name and password for a connection, but it should always be possible to override it. The user name as well so I don't have to create a connection for each user in each database.

    I logged an er (3649694) to track this request. Thanks for the feedback!
    -- Brian

  • Database Development with JDeveloper tutorial

    When I run the EMP_FETCHER body I do not get a Run PL/SQL dialog.
    Has anyone else had this problem?
    I using JDeveloper 10.1.3.0.4, Oracle database 10g Express Edition and Windows XP PRO.
    Thanks

    You can use the sqlplus.exe instead of the sqlplusw.exe the results should be the same.

  • XML Database Development with JDeveloper?

    Hello, folks:
    I am trying to create XML database through JDeveloper.
    Database: Oracle 10g
    IDE: JDeveloper 11.1.2.2.0
    JDBC Driver: Oracle ojdbc6.jar
    I connect successfully to the database through JDeveloper. There I see many folders listed, e.g. Tables, Views, Indexes, XML Schemas, XML DB Repository, and others. My problem is that when I try to save a large schema file (that I already validated on my local machine) that is roughly more than 300 lines, then JDeveloper is unable to save the file. It saves only very small files that are about 100 lines or less. The error message simply is: "Unable to save XML Schema blah.filename@local (Error saving XML Schema).
    I tried to do it in Oracle SQL Developer too, but got the same error. Can someone please help me understand this problem and how to fix it? Do I need to specify some settings in JDeveloper or SQL Developer? Thanks a lot in advance.
    Asif

    Please raise your question to the forum dedicated to JDeveloper 11:
    JDeveloper and OC4J 11g Technology Preview
    Regards,
    Didier.

  • Error in creating database diagram using JDeveloper

    Today I came across this weird error. I made an Identity column of type LONG and I had to create another column in same table with same data type i.e. LONG. I was surprised to see that JDeveloper did not let me create another column with type LONG. Error message was "*Invalid column Course_Parent_Id, the table already contains column Course_Id of type LONG*". Can someone guide me why this error occured and how to cater it.
    Help is appreciated in advance

    Isn't it a strange restriction?? If I need huge range for integral values in my database, it must have provision to do so. Anyways thanks for the reply. I have used NUMBER instead of LONG

  • Problem migrating database diagram from JDeveloper 10 to Jdeveloper 11

    Hi List,
    I have database diagrams created by use of JDeveloper 10 (files *.oxd_db), but (after automatic migration) they are not displayed as diafram in JDeveloper 11 (they are displayed as xml).
    If I create new diagrams from JDeveloper 10 I get *.db_diagram files.
    Anybody knows how to migrate JDeveloper 10 diagrams to JDeveloper 11?...
    Best regards
    Francesco

    Hi,
    >>>SAP BASIS 7.11 SWC, after importing it from the SLD
    you don't import that from SLD
    import it from TZP file from PI installation DVD
    then it will work
    Regards,
    Michal Krawczyk

  • How to create a database connection using Jdeveloper 10g

    when i try to create a database connection,its asking for connection name.is that connection name is user-defined or predefined name??In the next step its asking for username and password.where do i get that username and password.if anyone know this please explain me in detail coz this is for the first time am using JDeveloper.
    Thanks in advance.

    Hi user583040,
    May be you could have a look on this: http://my.opera.com/Tiftif/blog/faq-jdeveloper-english §5.2. If you have suggestions to improve this document, i will greatly appreciate to add them to it.
    Regards,
    Tif

  • Errors encountered using Database Diagram in JDeveloper 11g

    Tried to bring an existing MySQL 5.0 database schema into Database Diagram in JDev. Several problems encountered as listed below:
    1. For any columns that are with VARCHAR type and the length is greater than 255, I got "Display Width must be less than or equal to 255". Why JDeveloper sets such limitation even the DBMS allows? What I can do with it? I only want to do the ER modeling or do the reverse engineering here.
    2. I also got "A Foreign key constraint must define at least one column" for some tables that do have FK defined properly. The message seems suggest there is FK defined on NO column. It's not possible to create any constraint without specifying corresponding column(s) in the first place. So I feel this is a misleading message. But what's the really problem behind?
    Has anybody run into this? Any input is highly appreciated! Thanks.

    The details of the error code is like this:
    java.lang.ArrayIndexOutOfBoundsException: 4
         at oracle.jdbc.driver.T4C8TTIdty.marshal(T4C8TTIdty.java:465)
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:329)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490)
         at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
         at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)
         at oracle.jdeveloper.db.adapter.AbstractConnectionCreator.getConnection(AbstractConnectionCreator.java:117)
         at oracle.jdeveloper.db.adapter.DatabaseProvider.getConnection(DatabaseProvider.java:233)
         at oracle.jdeveloper.db.adapter.DatabaseProvider.getConnection(DatabaseProvider.java:156)
         at oracle.jdevimpl.db.adapter.CADatabaseFactory.createConnectionImpl(CADatabaseFactory.java:60)
         at oracle.javatools.db.DatabaseFactory.createConnection(DatabaseFactory.java:372)
         at oracle.javatools.db.DatabaseFactory.createDatabase(DatabaseFactory.java:142)
         at oracle.jdeveloper.db.DatabaseConnections.getDatabase(DatabaseConnections.java:633)
         at oracle.jdeveloper.db.DatabaseConnections.getDatabase(DatabaseConnections.java:560)
         at oracle.dbtools.raptor.utils.Connections$ConnectionInfo$ConnectRunnable.doWork(Connections.java:1083)
         at oracle.ide.dialogs.ProgressRunnable.run(ProgressRunnable.java:161)
         at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:615)
         at java.lang.Thread.run(Thread.java:595)
    I'm using JDeveloper 11g Technology Preview 3 to connect and got this error. I've try Jdeveloper 10g version 10.1.2, it can connect successfully.

  • Database Expression Edition & JDeveloper

    Hello, All!
    I have installed server Oracle Database Express Edition. I read Java Developer Guide for Express Edition (B25320) and followed instructions to create database connect, but i got some errors:
    I want connect to database from Jdeveloper and have errors:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-12705: cannot access NLS data files or invelid environment specified
    Please, help me.

    The Error Messages says:
    ORA-12705 invalid or unknown NLS parameter value specified
    Cause: There are two possible causes: Either an attempt was made to issue an ALTER SESSION statement with an invalid NLS parameter or value; or the NLS_LANG environment variable contains an invalid language, territory, or character set.
    Action: Check the syntax of the ALTER SESSION statement and the NLS parameter, correct the syntax and retry the statement, or specify correct values in the NLS_LANG environment variable. For more information about the syntax of the ALTER SESSION statement, see the Oracle9i SQL Reference
    Check first NLS_LANG setting at OS level: on Windows in the registry or on Unix the environment variable.
    See also OTN NLS_LANG FAQ.

Maybe you are looking for

  • Open PSDX file in photoshop touch

    Hi, I got myself a tablet with photoshop touch a while ago. Now the tablet is getting really slow, and I want to reset it to factory settings to remove all the accumulated junk. And I would like to keep my images. I don't have a Creative Cloud subscr

  • How to unlock network for iphone5?

    some said that settings>general>mobile/network or settings>celluar>celluar data network>set apn BUT in both method, I can't find it on my iphone!! P.S. My iphone5 is bought in HK (official store) How can I set the apn?? I will go to UK and use the gi

  • Specs say 1000 cycles- REAL???

    Specs say 1000 cycles on the MBP mid-2009 battery- My MBP mid-2009 has 380, am I OK with this battery for a while? OR, do I need to figure out how to replace it?? I'm not having any trouble other than shorter and shorter battery life off a power supp

  • TS1702 why won't an app downloaded on computer sync to my iphone

    I just downloaded an app from the app store online, but the app is not syncing to my iphone 4 in order to use it. I need help?

  • What DVD Media to buy?

    Hi- I've had problems getting my iMac's drive to burn Data DVDs. I've tried many brands- office max, comp usa, HP, staples, but none seem to work except the $$$ DVDs from the local Apple store, which for some reason, stopped carrying them. The apple