How to create  database connection in JDev

Dear Sir,
I am not able to create a connection to the Oracle9i database in JDeveloper.Plz guide me.
Thanx
Aradhana Jain

Please post this in the JDeveloper forums for an appropriate response: JDeveloper and ADF
OTN

Similar Messages

  • How to create database connection and how to call it using Java

    Hi,
    Good day! I'd like to know how I can create a db connection in JDev, then use this connection to retrieve data using a Java Class? I've seen using New Gallery > Database Connection. But I'm not sure how I can access this connection using Java and display some output from the retrieved records.
    Any steps/tutorial link is appreciated.
    Thanks in advance,
    Rian

    Hi,
    If you need to access the connection in the entity object then refer http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvgen.htm#BABEIFAI i.e in MODEL.
    But if you want to access connection in ViewController part of application then you need to do it manually.For this i am giving you my code for reference.------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import javax.faces.context.FacesContext;
    import oracle.jdbc.pool.OracleDataSource;
    public class DataHandler {
    String jdbcUrl = null;
    String userid = null;
    String password = null;
    Connection conn;
    public static final String CONNECTION_STRING =
    FacesContext.getCurrentInstance().getExternalContext().getInitParameter("connectionString");
    public static final String USER_NAME =
    FacesContext.getCurrentInstance().getExternalContext().getInitParameter("userName");
    public static final String PASSWORD =
    FacesContext.getCurrentInstance().getExternalContext().getInitParameter("password");
    public DataHandler(String jdbcUrl, String userid, String password,
    boolean shouldConnect) throws SQLException {
    this.jdbcUrl = jdbcUrl;
    this.userid = userid;
    this.password = password;
    if (shouldConnect) {
    connect();
    public void connect() throws SQLException {
    OracleDataSource ds;
    ds = new OracleDataSource();
    ds.setURL(jdbcUrl);
    conn = ds.getConnection(userid, password);
    public Connection getConnection() {
    return conn;
    public ResultSet executeQuery(String sql) throws SQLException {
    Statement s = conn.createStatement();
    return s.executeQuery(sql);
    public void closeConnection() throws SQLException {
    if (!conn.isClosed()) {
    conn.close();
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  • How to create database connection using DB2Driver in JDeveloper 10.1.2.1.0?

    I am trying to create a JDeveloper/Data Connection using com.oracle.ias.jdbc.db2.DB2Driver. The driver is registered from a User Libraries: DataDirect JDBC. I have the following class path for the library:
    E:\DataDirect\3.4\lib\YMdb2.jar;E:\DataDirect\3.4\lib\YMbase.jar;E:\DataDirect\3.4\lib\YMutil.jar
    I have no trouble configuring the connection but when I test it and I got ‘No suitable driver Vendor code 0’. What’s wrong? I have successfully created several database connections using Oracle thin driver. This is first time I am using a third party driver. Has any one successfully create a database connection using the com.oracle.ias.jdbc.db2.DB2Driver?

    Hi
    Since the error points to the unavailability of the driver class,can you double check your library claspath entries again.
    I just tried a DB2 connection using the following properties and the connection went through fine:
    Driver class name: com.oracle.ias.jdbc.db2.DB2Driver
    URL: jdbc:merant:db2://<host_name>:50000;DatabaseName=SAMPLE
    Thanks
    Prasanth

  • How to get database connection in common java class

    hi friendz,
    plz help me...
    I am using JDEV 11.1.2.2.0 version.
    my problem is I'm writing common java class which can reuse any application.
    in this case when im create database connection like this,
    String username = "a";
    String password = "b";
    String thinConn = "jdbc:oracle:thin:@IP:1521:database";
    DriverManager.registerDriver(new OracleDriver());
    Connection conn =
    DriverManager.getConnection(thinConn, username, password);
    conn.setAutoCommit(false);
    return conn;
    but this statement not working in java class.its working only backing bean.
    import oracle.jdbc.OracleDriver;
    DriverManager.registerDriver(new OracleDriver());
    how can i do that??
    hope your help
    -Harsh-

    What is the error message in Java class?
    With JDBC 4.0 driver the DriverManager class has added support for the Java SE Service Provider mechanism to the getConnection() and getDrivers() methods using which JDBC drivers may be loaded automatically. The following Class.forName() method is not required to be invoked.
    Class.forName(“oracle.jdbc.OracleDriver”);
    Only the following is required to obtain a connection.
    String url="jdbc:oracle:thin:@localhost:1521:ORCL";
    Connection connection = DriverManager.getConnection(url,"oe", "pw");

  • How to create JDBC connection in J2ME with MS-SQL server?

    I need to have database connection in PDA with SQL server,as i am new to J2ME ,i dont know how to create jdbc connection on J2ME device.Please help me out with this problem........

    I need to have database connection in PDA with SQL server,as i am new to J2ME ,i dont know how to create jdbc connection on J2ME device.Please help me out with this problem........

  • How to create database from servlet?

    Hey all,
    I want to create database and store the tables in that database.
    I don't have idea.
    any help..
    the concern is...
    I am using WSAD as a IDE.my backend is Oracle.
    First ,I need to check if user having ms-access in his system.if yes
    then I need to create datbase in that ..and store some tables in that database .
    any sample code snippet helpful for me..

    ok.Thank you.
    I am developing business application.The users enter some data.and I am storing that data into the oracle database.
    for every month...they need to check again that data and validate.
    for that...I want to create MS-access connection and get (oracle ) those data and store in ms-access ,I need to give link for that data to validate them. after that I will update.
    I don't have any idea how to store the data after i am retrieving data from the oracle database.how to generate link to that.
    now...I am trying to create database connection to the MS-ACCESS.I am
    using WSAD 5.1.2 VERSION.and jdk 1.4 version.
    below is my code..for connecting ms-access..
                        System.out.println("start connect");
                        try {
                             Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
                        } catch (Exception e1) {
                             e1.printStackTrace();
                        System.out.println("connected..");
                   Connection con=DriverManager.getConnection("jdbc:odbc:msd","","");
                   Statement stmt=con.createStatement();
                   result=stmt.execute("create table test(col1 char(10))");
                   System.out.println("the success");
    its giving below error. I know that the classpath error.But where I need to give that classpath .I think I need to get driver software from somewhere.please any suggestions......
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at java.lang.Class.forName1(Native Method)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at java.lang.Class.forName(Class.java(Compiled Code))
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.philips.servlets.DBGenerationServlet.dbCreate(DBGenerationServlet.java:102)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.philips.servlets.DBGenerationServlet.doPost(DBGenerationServlet.java:87)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.philips.servlets.DBGenerationServlet.doGet(DBGenerationServlet.java:73)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/7/06

  • How to create database link between oracle9i database and oracle10g

    How to create database link between oracle9i database and oracle10g
    oracle9i database name "Prod" windows server 2003 ( 172.x.x.x)
    oracle10g database name "TEST" sun solaris 9 (165.x.x.x.x)
    Please help me on this

    For connections between 10.2 and 9.2 the 9.2 end MUST be at 9.2.0.4 or higher. Connections between 10.2 and 9.2.0.1, 9.2.0.2 or 9.2.0.3 are not supported.
    Connections between 10.2 and 9.0.1 was never been supported.
    Cheers !!!!
    Bhupinder

  • How to create database in timesten?

    Please let me know how to create database in timesten as we create in Oracle 10g named orcl
    Please guide in detail
    Thanks.

    Hi!
    You can use TimesTen in standalone mode instead of Cache connect to Oracle.
    If you have deployed TimesTen on Linux then you should make DSN in sys.odbc.ini which is located in info folder of TimesTen. If you are using Windows then you can use ODBC utility in control panel.
    You can see the documentation of TimesTen for more detailed information.
    /Ahmad

  • How to create dynamic connection string with variables using ssis.

    Hello,
    Can anyone let me know on how to create dynamic connection string with variables using ssis?
    Any help would be appreciated.

    Hi vinay9738,
    According to your description, you want to connect multiple database from multiple servers using dynamic connection.
    If in this case, we can create a Table in our local database (whatever DB we want) and load all the connection strings.  We can use Execute SQL Task to query all the connection strings and store the result-set in a variable of object type in SSIS package.
    Then use ForEach Loop container to shred the content of the object variable and iterate through each of the connection strings. And then Place an Execute SQL task inside ForEach Loop container with the SQL statements we have to run in all the DB instances. 
    For more details, please refer to the following blog:
    http://sql-developers.blogspot.kr/2010/07/dynamic-database-connection-using-ssis.html
    If there are any other questions, please feel free to let me know.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to create a connection pooling in Netbeans 6.0 using the oracle driver

    hi all,
    I am using Netbeans 6.0. Apache Tomcat 6.0.14 server, oracle 9i.
    I tried to create a connection pooling using tomcat web server.
    I have included the following code in context.xml and web.xml.
    CONTEXT.XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/network1">
    <Resource name="jdbc/myoracle"
    auth="Container"
    type="javax.sql.DataSource"
    username="scott"
    password="tiger"
    factory="BasicDataSourceFactory"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:odbc:thin:@127.0.0.1:1521:mydb"
    maxActive="20"
    maxIdle="10"
    maxwait="-1"/>
    </Context>
    WEB.XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <resource-ref>
    <description>Oracle Datasource example</description>
    <res-ref-name>jdbc/myoracle</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    After that i have included the following JDBC driver's jar files in the $Catalina_Home/lib folder.
    classes 111.jar,
    classes 111_g.jar
    classes12.jar
    classes 12_g.jar
    classes12dms.jar
    classes12dms_g.jar
    nls_charset11.jar
    nls_charset12.jar
    ocrs12.jar
    ojdbc14.jar
    ojdbc14_g.jar
    Then i stop the tomcat web server and start it again.
    In jsp page i have included the following code:
    Context ctx=new InitialContext();
    Context envctx=(Context)ctx.lookup("java:comp:env");
    DataSource ds=(DataSource)envctx.lookup("jdbc/myoracle");
    Connection con=ds.getConnection(); ----->(In this line an error occured that Connection class cannot be found.)
    please help me how to create a connection pooling and rectify the error in conneciton.
    Thanks in advance

    Please refer
    http://www.netbeans.org/kb/60/web/customer-book.html

  • How to create database in 10g xe

    How to create database in 10g xe? could you please direct me to which documentation in 10g xe website? is it possible to create the db from the web console? if so, how? I can't seem to find a way to do it? Thanks

    You cannot: there can only be one XE database per host and it's created when you install Oracle XE.

  • How to create dynamic connection in business view manager.

    Hi Sir,
    Can u explain how to create dynamic connection in business view manager.
    Thanks
    Vishali Raghava Raju

    HI Vaishali,
       Can you please elaborate your requirement ?
    -Regards
    B

  • When and How to close database connection in JSP?

    Hi there,
    I am using MySQL and JDBC 3.0, in my system, When and How to close database connection in JSP?
    Thanks in advance.
    Lonely Wolf
    <%@ page session="true" language="java" %>
    <jsp:include page="checkauthorization.jsp" />
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <%--
    Execute query, with wildcard characters added to the
    parameter values used in the search criteria
    --%>
    <sql:query var="availablecomputerList" dataSource="jdbc/Bookingcomputer" scope="request">
    SELECT * FROM computer where status=0
    order by s_code
    </sql:query>
    <html>
    <head>
    <title>Search Result</title>
    </head>
    <body bgcolor="white">
    <center>
    <form action="checkin.jsp" method="post">
    <input type="submit" value="Back to Check-in Page">
    </form>
    <c:choose>
    <c:when test="${availablecomputerList.rowCount == 0}">
    Sorry, no available computer found.
    </c:when>
    <c:otherwise>
    The following available computers were found:
    <table border="1">
    <th>Computer</th>
    <th>Description</th>
    <th>Status</th>
    <c:forEach items="${availablecomputerList.rows}" var="row">
    <tr>
    <td><c:out value="${row.s_code}" /></td>
    <td><c:out value="${row.description}" /></td>
    <td><c:out value="${row.status}" /></td>
    </tr>
    </c:forEach>
    </table>
    </c:otherwise>
    </c:choose>
    </center>
    </body>
    </html>

    when should you close the connection? when you're done with it.
    how should you close the connection? like this: conn.close();
    that said, doing this in a JSP page is bad form and not recommended
    JSP's typically don't contain ANY business or data logic

  • How to create database from .sql file

    how to create database from .sql file..?? i put the sintax query in a sql file.. and i want to call it in java code..
    ho to do it..??

    why do you want to do this from java?
    i just don't see the point.
    find your dba and have him/her run it for you

  • How to create database item for fast formula?

    Hi,
    Is there any document for how to create database item for fast formula? I could not find in Metalink or this forum. Thanks.
    Andy

    Oracle ship many pre-delivered Database Items plus they're created automatically when you create Input Values (etc).
    There's often something already there for you. If there's not, you usually create Fast Formula functions to retrieve other data. You don't create your own custom DBIs; Oracle don't deliver APIs for that.

Maybe you are looking for

  • After Refresh ROOSGEN missing MSGTYP for 0MATERIAL_TEXT

    We have recently refreshed our R/3 and BW systems from PRD. After the refresh we noticed that 0MATERIAL_TEXT delta was not bringing any records into BW. The other deltas are working just fine. After investigation we found that table ROOSGEN is missin

  • HELP: collection as in parameter of SP using jdbc

    Hi, everyone: i'm trying to pass an array of int value to a stored_procedure using jdbc, but i cannot figure out how to write the exact code. i always get the same exception: java.sql.SQLException: invalid name schema. i have searched this section an

  • No outline levels from Project Online main project page?

    I'm still relatively new to Project Online, but I have four projects I have showing on the project page of Project Online. Three from SharePoint task lists and one Enterprise Project.  All I can see is the project name and related columns.  If I want

  • Analyzer 5.03 Forms not showing on the java client

    I have created several views and forms from one database. On the main form I have several buttons that connect to sub forms with views combined in them. Before I made several changes on the main form it worked fine, today I made several changes renam

  • Passivation/activation trouble when using proxy DB authentication

    Hello, I have an application module which uses database proxy authentication. A user authenticates with his own login/password and AppModuleImpl.java implements following methods: https://blogs.oracle.com/imc/entry/how_to_use_database_proxy . It work