Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 504 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
504
Dung lượng
6,18 MB
Nội dung
[...]... hard and outstanding work and caring attitude were always refreshing and rejuvenating She was well organized and helped me tremendously in many ways Also, I thank Elizabeth Seymour (who took over as project manager) for her great work and tremendous support • I thank Liz Welch, copy editor, for her outstanding editing and understanding of my language andJDBC code She is very smart and understands... applications, andJDBC deals with data and metadata stored and manipulated in relational database systems (RDBMSs) Note that each RDBMS has a lot of metadata,andJDBC maps some of those metadata in a uniform and consistent fashion by its API ■ Note In using the word metadata, we must use the exact term when it is a Java API (since Java is a casesensitive language)—for example, DatabaseMetaData, RowSetMetaData,... (such as Oracle and MySQL) For more details, refer to JDBC Recipes: A Problem-Solution Approach (Apress, 2005) and Sun’s official site on JDBC: http://java.sun.com/products /jdbc/ index.jsp Note that you can have more than one driver and therefore more than one database Figure 1-2 illustrates how a Java application uses JDBC to interact with one or more relational databases (such as Oracle and MySQL)... using JDBC to connect to a database, Let’s use Oracle s type 4 JDBC driver as an example First, the main driver class must be loaded into the Java virtual machine (VM): Class.forName( "oracle .jdbc. driver.OracleDriver"); The specified driver (i.e., the oracle .jdbc. driver.OracleDriver class) must implement the java.sql.Driver interface A class initializer (a static code block) within the oracle .jdbc driver.OracleDriver... by using a set of questions and answers Java andJDBC are trademarks or registered trademarks of Sun Microsystems, Inc in the United States and other countries According to Sun Microsystems, JDBC is not an acronym and does not stand for Java Database Connectivity (but the fact of the matter is that most Java engineers believe that JDBC stands for Java DataBase Connectivity) JDBC is a platform-independent... interface between relational databases and Java In today’s Java world, JDBC is a standard API for accessing enterprise data in relational databases (such as Oracle, MySQL, Sybase, PostgreSQL, and DB2) using SQL (Structured Query Language) In this chapter, we will examine the basic aspects of JDBC, and save the details about JDBC metadata for upcoming chapters Data and metadata (data about data/information)... about data) or annotation-based code recipes for JDBC API for use with Oracle and MySQL The book provides complete and working solutions for performing database metadata tasks using JDBC You can cut and paste solutions from this book to build your own database metadata applications All the solutions have been compiled and tested against two leading databases: MySQL and Oracle This book is ideal for anyone... read/write basic Java programs) and some JDBC (can read/write basic queries using JDBCand SQL) and wants to learn more about database and result set metadata Each section of this book is a complete recipe (including the database setup, the solution, and the solutions for both MySQL and Oracle) , so you can use the code directly in your projects (although sometimes you may need to cut and paste only the sections... from the database) JDBC allows Java programs (applets and applications) to communicate with relational databases (so-called SQL databases) easily and efficiently JDBC consists of classes in the package java.sql and some JDBC extensions in the package javax.sql Both of these packages are included in the Java 2 Standard Edition (J2SE) version 1.5 (which covers JDBC 3.0) On the other hand, JDBC metadata (data... about the underlying JDBC driver implementations Figure 1-2 illustrates the core JDBC classes and interfaces that interact with Java andJDBC applications This figure also shows the basic relationships of the DatabaseMetaData and ResultSetMetaData interfaces with other JDBC objects Figure 1-2 Using JDBC database metadata 3 6374_c01_final.qxd 4 1/27/06 12:41 PM Page 4 CHAPTER 1 ■ WHAT IS JDBC PROGRAMMING? . Parsian
JDBC Metadata, MySQL,
and Oracle Recipes
A Problem-Solution Approach
6374_FM_final.qxd 1/27/06 12:38 PM Page i
JDBC Metadata, MySQL, and Oracle Recipes: . Welch, copy editor, for her outstanding editing and understanding of my
language and JDBC code. She is very smart and understands a lot about “metadata.”
Her