Introduction to JDBC

Source: Internet
Author: User

Introduction to JDBC on the south China kapok Station

Sender: yeal (broken disc), email area: JAVA
Question: JDBC (1)
Mail station: China South Network Mu Mian station (Mon Feb 1 00:03:32 1999), mail

1. Introduction
Many developers and users are looking for a convenient way to access the database in Java programs.
Method. Java is robust, secure, easy to use, easy to understand, and
Automatically download from the network, so it becomes a type
Good language basics. It provides C, C ++, Smalltalk, BASIC, COBOL,
And 4GLs has many advantages. Many companies have begun to connect to DBMS in Java.
.
Many Java application developers want to write programs independent of specific DBMS.
While we also believe that a DBMS-independent interface will
DBMS connections become the most convenient and rapid development. So we think the definition
A general SQL database access framework that provides database connections in a variety of ways
It is very meaningful to provide a unified interface on the module. This allows programmers
For a single database interface, make database-independent Java tools and products available
Yes, so that database connection developers can provide a variety of connection solutions.
We can see that we define a general low-level Java that supports basic SQL Functions
DataBase Connectivity (JDBC) API is a pressing task.
Fortunately, we don't have to design an SQL API from scratch. We can
Work is built on
X/Open SQL CLI (call layer interface) (it is also Microsofts ODBC
).
Our main task is to define a natural Java interface
Basic abstraction layer and conceptual connection.
Jdbc api obtains the database development vendor, connection development vendor, ISV, and Application
Developer support is very important. We believe that our work is based on
Based on the ODBC abstraction layer, JDBC is more easily accepted. And
Technically, ODBC is a good foundation for our design work.
Because ODBC is a C language interface, ODBC is directly used in Java
Appropriate. Calling C code from Java is secure, robust, and easy to implement,
Portability is inconvenient. It makes Java
Advantages cannot be realized.
We have implemented an ODBC-based API in the short term. Long Term
We can provide implementation in other ways.
1.1. Note
We are very grateful for the many fields in database, database connection, and database tools.
Early workers. They provide good comments and
Recommended. Their work has played an immeasurable role in this provision.

--
※Source:. bbs.gznet.edu.cn. [FROM: 202.38.240.203]

--------------------------------------------------------------------------------

[Back to homepage] [discussion board]
Sender: yeal (broken disc), email area: JAVA
Question: JDBC (2)
Mail station: China South Network Mu Mian station (Mon Feb 1 00:04:05 1999), mail

2. Goals and Philosophy
This section describes the goal and philosophy of guiding this API development.
2.1. SQL-level API
Our main goal is to define a "call-level" SQL statement for Java
Interface. This means that our primary focus is on executing the original SQL statement.
Statement and retrieve the result. We expect that high-level APIs will also be defined.
Can be built on grass-roots interfaces.
These high-level interfaces include directly and transparently copying data in the table
In the Java class, the syntax tree is used to represent more general queries, and
SQL syntax.
We hope that a large number of application development tools will use our APIs. However, we also
We hope that programmers can use our APIs, especially in Java.
If there is any other means (or database access means.
2.2. Follow SQL
The database system supports a variety of SQL syntax and semantics.
Advanced functions such as external connections and embedded processes are inconsistent.
We hope that the SQL of these parts will be standardized over time.
. At the same time, we adopt this attitude and position:
In fact, an application query need not even be SQL, or it may be
Specialized derivative of SQL, e.g. for document or image queries,
Designed for specific DBMSs. In order to pass JDBC compliance tests and to be
Called "JDBC
COMPLIANT? We require that a driver support at least ANSI
SQL-2 Entry Level. This gives applications that want wide
Portability a guaranteed least common denominator. We believe
ANSI SQL-2 Entry Level is reasonably powerful and is reasonably
Widely supported today.
L JDBC allows the query expression to be passed directly to the underlying data driver.
Programs can obtain as many SQL functions as possible, but may be rejected by DBMS
Absolutely. In fact, the query of a program can be not even SQL, or
Is a special evolution of SQL, such as text designed for specialized databases.
Or graph query.
L to pass the JDBC compatibility test and be called JDBC compatibility,
We require a driver to support at least ANSI SQL-2 standards. This makes
Some programs that require extensive portability get a minimum denominator (the original
This gives applications that want wide portability
Guaranteed least common denominator .). We believe that ANSI
SQL-2 is strong enough and is well supported.

--
※Source:. bbs.gznet.edu.cn. [FROM: 202.38.240.203]

--------------------------------------------------------------------------------

[Back to homepage] [discussion board]
Sender: yeal (broken disc), email area: JAVA
Question: JDBC (3)
Mail station: China South Network Mu Mian station (Mon Feb 1 00:04:36 1999), mail

2.3. JDBC must be available on the existing database interface
We must be able to ensure that jdbc SQL APIs can be built on common SQL
API, especially ODBC. These requirements are already part of this specification
Has an impact, especially for outgoing parameters (OUT parameter) and big data blocks.
Processing.
2.4. Ensure that this interface is consistent with other parts of the JAVA System.
At present, the positive response to JAVA has been very enthusiastic. This is largely because
Language standards and standard runtime libraries are considered to be consistent, simple, and powerful.
We will do our best to provide this Java database interface, which will be created
We hope that common tasks can be simple, but not general tasks are feasible.
.
A common task refers to a programmer executing a simple SQL statement without parameters.
Statement (for example, SELECT, INSERT, UPDATE, DELETE), and then (for example
SELECT) Processing returned tuples of simple type. An input parameter
(IN parameter) SQL statements are also common.
Not so common, but it is also very important when programmers use
The SQL statement of the INOUT and OUT parameters. We also need to support reading and writing several megabytes.
Object SQL statements, more specifically, one statement returns multiple
Result set.
We hope that the metadata (Meatdata) is rarely used, but only those skilled programs
Developers and development tools. Metadata access functions and Dynamics
The type data access function is at the end of this document.
These chapters.
2.8. Different functions are implemented by different methods (functions)
(The original text of "method" is: method, so the translation is based on VB)
An interface design style is a process that uses a small number of parameters.
In this way, they can be used to affect various rows within a large range.
Yes. To express different functions. This tends to work with a lot of methods, but each
Both methods agree to understand.
Generally, Java kernel classes use different methods ). This step
The main advantage of this step is that programmers who start learning the basic interface do not have
Parameters related to complex functions are plagued. We try to use the JDBC interface
The same policy. Generally, different methods are used instead of different labels.
And multi-purpose methods.

--
※Source:. bbs.gznet.edu.cn. [FROM: 202.38.240.203]

--------------------------------------------------------------------------------

[Back to homepage] [discussion board]
Sender: yeal (broken disc), email area: JAVA
Question: JDBC (4)
Mail station: China South Network Mu Mian station (Mon Feb 1 00:05:20 1999), mail

3. Interface Overview

Interfaces are divided into two levels: one is the jdbc api for program developers?

The other is the underlying JDBC Driver API.

3.1. JDBC API

JDBC APIs are described as abstract Java interfaces of Yi people. Similar applications are far away.

Can I open a connection to a database, execute SQL statements, and process the results?

Error! The embedded object is invalid.

The most important interfaces are:

L java. SQL. DriverManager

Process the incoming traffic of the driver and provide support for new database connections.

L java. SQL. Connection

Represents the connection to a specific database

L java. SQL. Statement

It represents a specific container to execute SQL statements on a specific database.

L java. SQL. ResultSet

Controls the access to row data of a specific statement

Java. SQL. Statement has two subtypes:

1. java. SQL. PreparedStatement

Used to execute pre-compiled SQL statements.

2. java. SQL. CallableStatement

Used to execute a database.

Typical use scenarios is help-ful. There are two common scenarios

That must be treated differently for our purposes: applets and

Applications.

Before reading the jdbc api, it is helpful to know the typical application scenarios. Connect

There are usually two situations that must be treated separately: applet and application.

--
※Source:. bbs.gznet.edu.cn. [FROM: 202.38.240.203]

--------------------------------------------------------------------------------

[Back to homepage] [discussion board]
Sender: yeal (broken disc), email area: JAVA
Question: JDBC (5)
Mail station: China South Network

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.