«

»

Aug
04

Java JDBC with using Oracle


The JDBC is used whenever a Java application should communicate with a relational database for which a JDBC driver exists. JDBC is part of the Java platform standard; all visible classes and interfaces used in the JDBC are placed in package Java

Main JDBC classes:

Download the Java connecting with Oracle Code, you have to oracle jdbc driver jar file in your project library reference or in your classpath so that you compiler can find the oracle jdbc jar file….

MyOracle.java  oracle-java-jdbc-driver.jar

  • DriverManager. Manages a list of database drivers. Matches connection requests from the java application with the proper database driver using communication subprotocol. The first driver that recognizes a certain subprotocol under jdbc will be used to establish a database Connection.
  • Driver. The database communications link, handling all communication with the database. Normally, once the driver is loaded, the developer need not call it explicitly.
  • Connection. Interface with all methods for contacting a database
  • Statement. Encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
  • ResultSet. The answer/result from a statement. A ResultSet is a 2D list which encapsulates all outgoing results from a given SQL query.

    What is a database URL

    A database URL (or JDBC URL) is a platform independent way of addressing a database. Exact formation changes from database to database and from one type of driver to another.A database/JDBC URL is of the form

    jdbc:[subprotocol]:[node]/[databaseName] Example :

    jdbc:oracle:thin:@oracleserver:1521:oracle9i   –> to access Oracle using thin driver

    What types of JDBC drivers exist?

    There are four types of JDBC database driver:

    Driver type

    Explanation

    Comment

    1

    The JDBC/ODBC bridge driver

    A piece of native C-code that translates a JDBC call to an ODBC call. Use this driver for development, not for industrial-strength application environments. Note that you have to have an ODBC database driver manager + an ODBC database driver installed on the server in addition to the JDBC/ODBC bridge.

    2

    Native API partly java driver

    A piece of native C-code that translates a java JDBC call to a native database call level API. Use this driver for development and deployment. Due to its native code, this driver can only be used by Java Applications with full computer access (i.e. not Applets).

    3

    JDBC-Net pure Java driver

    A piece of pure java code that translates an incoming JDBC call to an outgoing database Net protocol call (such as SQL*Net). Use this driver for development and deployment. Flexible and powerful, This driver can be used by any Java component and requires only connect access to work.

    4

    Native protocol pure Java driver

    A piece of pure java code that translates an incoming JDBC call to an outgoing database native protocol call (such as Oracle CLI). Use this driver for development and deployment. This driver type is the recommended one for server-side java development.

    VN:F [1.9.13_1145]
    Rating: 0.0/10 (0 votes cast)
    VN:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

    About the author

    Faisal Basra

    Faisal Basra is an independent consultant, software developer, writer, blogger, speaker, architect and technology leader in Lahore, Pakistan. He has been a professional software developer since 2008, has been writing code since 2006. Having hands on experience of popular Java EE frameworks & technologies like JSF, Spring, Hibernate, Enverse, JPA, Richfaces, Primefaces, JSP/Servlet. I have taken many initiatives while working with teams. Some of includes Automated Build & Release Management system via Hudson, Maven, Archiva & SVN. Blogging is my hobby and I also initiated blog at corporate level from setting up complete blog for company, content generation strategy and visibility over the Internet by Internet Marketing. Framworks & Technologies: JSF, Richfaces, Primefaces, Openfaces, Struts, Hibernate, Spring, ORMLite Tools & Servers: jUnit, Log4j, Maven, Eclipse, MyEclipse, NetBeans, Tomcat, Jboss, WebLogic Mobile Development: Google Android Marketing: Internet Marketing, Mobile App Marketing

    Permanent link to this article: http://www.javaplex.com/blog/java-jdbc-with-using-oracle/

    1 comment

    1. htc pure (http://www NULL.htc-pure NULL.com) says:

      i’ve had my pure for a week now and that i still dont know what to do… like altering the message alert tone to no matter i want it not simply the basic ones on the phone… the whole lot about this telephone is complicating.. i additionally wanted to vary to that android software program as a result of windows is just too slow and someone please assist me how to do that

      VA:F [1.9.13_1145]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.13_1145]
      Rating: 0 (from 0 votes)

    Leave a Reply

    Your email address will not be published.

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>