Java Reference
In-Depth Information
}
}
}
Here is the result of running the code:
Successfully connected
-- Record created --
13-1 Connecting to a Database DriverManager and
DataSource Implementations
13-2 Querying a Database and Retrieving Results
Obtaining and Using Data from a DBMS
13-3
Handling SQL Exceptions Using SQLException
13-4
Performing CRUD Operations
How to Perform
Create, Read, Update, Delete Functions
-- Record Updated --
-- Record Deleted --
-- Final State --
13-1
Connecting to a Database
DriverManager and
DataSource Implementations
13-2 Querying a Database and Retrieving Results
Obtaining and Using Data from a DBMS
13-3
Handling SQL Exceptions Using SQLException
How It Works
The same basic code format is used for performing just about every database task. The
format is as follows:
1.
Obtain a connection to the database.
2.
Create a statement from the connection.
3.
Perform a database task with the statement.
4.
Do something with the results of the database task.
5.
Close the statement (and database connection if you're finished using
it).
Search WWH ::




Custom Search