Chapter 12. JDBC

   

This chapter introduces JDBC, the Java database connectivity technology. JDBC offers developers a standard library for accessing databases and working with queries. This chapter assumes that you have knowledge of relational database design and know how to write at least basic SQL queries to select, insert, update, and delete data from a database.

JDBC standardizes the mechanisms for connecting to databases so that you can use the API with MySQL, Microsoft SQL Server, Oracle, or any other database that implements JDBC with your Java programs.

Working with databases in Java requires a good deal more manual effort on the part of the developer than it does from within ColdFusion. There is no ColdFusion Administrator to handle establishing the datasource ”this must be done programmatically in Java. While initially the amount of code required to retrieve a result set may seem intimidating, much of your code can be reused.

The JDBC is currently in version 3.0, and now with Java 1.4, all of the API is included with the JDK; you do not need to download JDBC extension classes to work with databases. The only other thing you will need to work through the examples in this chapter is access to some kind of database system. We will demonstrate examples using Microsoft Access and MySQL, though the examples will work with little modification in enterprise RDBMSs such as Oracle, Microsoft SQL Server, or DB2. You can download a free version of MySQL from www.mysql.com.

Using JDBC, you have the full power that you are used to enjoying from within ColdFusion applications. You can use it to connect to enterprise DBMSs, object-oriented databases, Excel spreadsheets, FoxPro databases, plain text files, and more.


   
Top


Java for ColdFusion Developers
Java for ColdFusion Developers
ISBN: 0130461806
EAN: 2147483647
Year: 2005
Pages: 206
Authors: Eben Hewitt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net