Java JDBC Connection - Obtaining the JDBC driver
Before you start working with JDBC, you'll need a copy of the Java JDK. If you don't have it already, you can get the JDK/SDK for free at Sun's Java web site, or it will also be included with many IDEs that you can use, including Eclipse and NetBeans.
Once you have the JDK, the next thing you need to do is to get the correct JDBC driver for your database. In most cases the JDBC driver will be provided by your database vendor. To make it even easier, I've created a page of JDBC drivers for common SQL databases.
Once you have the correct JDBC driver for your database, install it according to the instructions that came with it. Installation instructions will vary somewhat for each vendor.
Establishing a JDBC database connection in two steps
Once you have the correct JDBC driver installed, establishing a JDBC connection from your Java programs to your SQL database is pretty easy.
Regardless of whether you're trying to connect to Oracle, SQL Server, MySQL, Postgres, mSQL, or Interbase (or any other JDBC data source), establishing a connection to an SQL database with Java JDBC is a simple two-step process:
- Load the JDBC driver.
- Establish the JDBC connection to your database.
We'll show you two JDBC examples just so you can see how easy it is, and how little the code changes when you migrate from one database server to another.
No comments:
Post a Comment