Author: axeon
The first thing you need to do is to install it correctly. This includes the following steps:
Install Java and JDBC on your computer
Java database connection (JDBC) is a standard SQL (Structured Query Language, Structured Query Language) database access interface that provides unified access to a variety of relational databases. JDBC (Java DataBase Connection) also provides a benchmark to build more advanced tools and interfaces. The current JDK (Java Development Kit, Java Development Kit) software bundle includes JDBC and JDBC-ODBC (Open DataBase Connection, Open DataBase Connection) Bridge. These packages can also be obtained independently and used together with JDK 1.0. It should be noted that the example in this article uses the JDBC 2.0 interface, which requires JDK 2.0 to run and cannot run under JDK 1.1.
You can find the latest version from the http://java.sun.com/products/JDK/CurrentRelease.
Install the driver
Your driver should have the installation method. When installing a JDBC Driver written for a specific DBMSs, you only need to copy it to your computer. No special configuration is required.
If you download Solaris or Windows JDK1.1, the bridge is automatically installed together with JDK as the sun. jdbc. odbc package. For information on installing and configuring ODBC, consult the ODBC driver vendor. No special configuration is required for the bridge. For information about Client installation and configuration, consult the database vendor.
If necessary, install the Database System
If you cannot confirm whether the database system is installed, you need to install the database according to the supplier's requirements. Most users have already installed databases and can continue to use the databases they have installed.
Configure Database
Assume that the database COFFEEBREAK already exists. (Creating a database is not difficult, but requires certain permissions and is usually done by the database administrator.) You also need to create a table in this database as an example. We intentionally limit the table size and number to facilitate management.
Assume that our database is used in a coffee shop. The coffee beans are sold by pound, while the coffee is made by cup. For simplicity, It is also assumed that the operator only needs two tables to store information about different types of coffee and coffee suppliers.
First, we will demonstrate how to open a DBMS connection and how JDBC sends SQL statements to your DBMS. With this code, we will show that it is very easy to pass SQL statements to your DBMS using JDBC and process the returned results.
All the code is tested in several major DBMS products. However, if you use the JDBC-ODBC bridge to connect to the old ODBC driver, you may encounter some compatibility issues