Results 1 to 4 of 4

Thread: Connection of Java applications to Database

  1. #1
    Join Date
    Jan 2010
    Posts
    52

    Connection of Java applications to Database

    Can you provide me some information about connection of java application to database and what are the stuff should be available to build this project. I want to use oracle database and for oracle which type of driver would be used.I am confused to use the provided drivers for java application.which type of driver would be used for different java applications.I am so curious to know about the JServer and how it would be configure on my machine.
    Last edited by Gerri; 27-01-2010 at 02:01 PM.

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Connection of Java applications to oracle

    Here is one example which will show you a demo to connection of an java application to oracle database,it uses JDBC driver for connection.

    import java.sql.*;
    class javatooracle
    {
    public static void main (String args []) throws SQLException
    {
    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@hostname:1526:mydb", "Hr", "Hr");
    // @IP address :portname:databaseID, userid,password

    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
    while (rset.next())
    System.out.println (rset.getString(1));
    stmt.close();
    }
    }

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    JDBC in Java to Oracle connection

    JDBC:

    JDBC is simply a class and interface which is written in java language to execute those java program which is written to retrieve data from the database.
    It accept the SQL statement from the program and access the data from database and returns to application.
    Oracle database provides three types of JDBC driver:

    1. JDBC Thin Driver is required for applets in java
    2. JDBC OCI for simple and standalone applications in java
    3. JDBC KPRB driver for stored procedure and java server pages
    Last edited by kelfro; 27-01-2010 at 02:39 PM.

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    JServer in Oracle Database

    JServer:
    The oracle database facilitate to the java programmer a tool JServer Accelerator which speed up the code execution of java applications.

    Configuring JServer:

    1. Confirm, your instance should be started with more than 20M
    of java_pool_size and 50M for shared_pool_size space for this configuration

    2. execute the $ORACLE_HOME/javavm/install/initjvm.sql file with the sys account
    3. Type the statement given below:

    SQL> GRANT JAVAUSERPRIV TO SCOTT;

    Now "scott" user can use this privilege to execute the script regarding JVM and follow the "Oracle Migrations Guide" to know more about this.

Similar Threads

  1. Can't Run Java Applications
    By mayank240 in forum Portable Devices
    Replies: 1
    Last Post: 25-10-2010, 09:55 AM
  2. Database generator for java
    By Miles Runner in forum Software Development
    Replies: 5
    Last Post: 06-03-2010, 01:56 PM
  3. Java in oracle 9i database
    By Gerri in forum Software Development
    Replies: 4
    Last Post: 03-02-2010, 08:35 PM
  4. Java and database
    By AMISH in forum Software Development
    Replies: 5
    Last Post: 12-12-2009, 07:17 PM
  5. Problem while database connection in java
    By Jagriti in forum Software Development
    Replies: 3
    Last Post: 17-11-2009, 11:32 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,214,454.58679 seconds with 17 queries