Java connection process and steps for oracle11g Database

Source: Internet
Author: User

Database Operations are similar, such as mysql, oracle, and sqlserve operations.

The first step is to load the driver package.

Step 2: connect to the database through the connection path

Step 3 is the operation .. The following is basically the same:

For example, the Process Code for connecting to the oracle11g database in java

First, load the driver package and find the ojdbc6.jar package in the app \ tao \ product \ 11.2.0 \ dbhome_1 \ jdbc \ lib path under the oracle11g installation directory to your workspace building> private final String NAME = "scott "; // Database Name
Private> private Connection conn = null; // Connection object
Private PreparedStatement> private ResultSet rs = null; // The queried object.
/**
* @ Param>} catch (SQLException e ){
// TODO Auto-generated> try {
Pr = conn. prepareStatement ("select *> while (rs. next ()){//
Str = rs. getInt (1) + "";
Str = str + rs. getString (2) + "";
Str = str + rs. getString (3) + "";
Str = str + rs. getString (4) + "";
Str = str + rs. getDate (5) + "";
Str = str + rs. getString (6) + "";
Str = str + rs. getDate (7) + "";
Str = str + rs. getInt (8) + "";
Str = str + rs. getString (9) + "";
}
}> Da. connection (); // call a function to operate the database
}

}

The oracle database is connected, and you can operate the database ....

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.