|
JDBC Tutorial
In this lesson you will learn the basics of the JDBC API. We start by giving you set up instructions in Getting Started , Setting Up a Database , and Establishing a Connection . The next sections discuss how to create and update tables, use joins, transactions and stored procedures. The final sections give instructions on how to complete your JDBC application and how to convert it to an applet.
|
|
What Is JDBC?
Working with leaders in the database field, JavaSoft developed a single API for database access--JDBC
|
|
Connecting to the Database
Now I am going to dive into the details about JDBC calls and how to use them. Any JDBC application we write needs to be able to run from start to finish without ever referencing a specific JDBC implementation. Figure 4-2 shows how an application uses JDBC to talk to one or more databases without knowing any of the details concerning the driver implementation for that database. An application uses JDBC as an interface through which it passes all of its databases requests.
|
|
Basic Database Access
Now that you are connected to the database, you can begin making updates and queries. The most basic kind of database access involves writing JDBC code where you know ahead of time whether the statements you are sending are updates (INSERT, UPDATE, or DELETE) or queries (SELECT). In the next chapter, we will discuss more complex database access that allows you to execute statements of unknown types.
|
|
The JDBC API
The Java Database Connectivity (JDBC) API is one of the most important APIs for enterprise-level
development because you almost always need to access a database. JDBC gives you a standard API that
is mostly database-independent, but still allows you to access specific features of your database if
necessary.
|
|
The JDBC Support Classes
JDBC provides a handful of other classes and interfaces that support JDBC's core functionality. Many of them are more SQL-friendly extensions of java.util classes like java.sql.Date and java.sql.Numeric. Others are exception classes that get thrown by JDBC calls.
|
|
Database Access Through JDBC
Database programming has traditionally been a technological Tower of Babel. We are faced with dozens of available database products, and each one talks to our applications in its own private language. If your application needs to talk to a new database engine, you have to teach it (and yourself) a new language. As Java programmers, however, we should not be worrying about such translation issues. Java is supposed to bring us the ability to "write once, compile once, and run anywhere," so it should bring it to us with database programming as well.
|
|
JDBC Basics
In this lesson you will learn the basics of the JDBC API. We start by giving you set up instructions in Getting Started , Setting Up a Database , and Establishing a Connection . The next sections discuss how to create and update tables, use joins, transactions and stored procedures. The final sections give instructions on how to complete your JDBC application and how to convert it to an applet.
|
|
A second look to What Is JDBC?
JDBCTM is a JavaTM API for executing SQL statements. (As a point of interest, JDBC is a trademarked name and is not an acronym; nevertheless, JDBC is often thought of as standing for ``Java Database Connectivity''.) It consists of a set of classes and interfaces written in the Java programming language. JDBC provides a standard API for tool/database developers and makes it possible to write database applications using a pure Java API.
|
|
JDBC Advanced Tutorial
The JDBC 2.0 API includes many new features in the java.sql package as well as the new Standard Extension package, javax.sql. This new JDBC API moves Java applications into the world of heavy-duty database computing. New features in the java.sql package include support for SQL3 data types, scrollable result sets, programmatic updates, and batch updates.
|
|
Write Once Persist everyhere
Most J2EE (Java 2 Platform, Enterprise Edition) applications strive to abstract the database tier by employing the Data Access Object (DAO) design pattern. However, these implementations typically deal with project-specific object types. This article shows you a DAO pattern framework that you can reuse on all your projects, regardless of object type.
|
|
JDBC Rowset Tutorial
Rowsets make it easy to send tabular data over a network. They can also be used to provide scrollable result sets or updatable result sets when the underlying JDBCTM driver does not support them.
|
|
Tuning JDBC: Measuring JDBC performance
Java Database Connectivity (JDBC) is used extensively by many Java applications. In this article, the first of a series on performance-tuning JDBC, I look at how to measure the performance of JDBC and how to identify which parts of your JDBC subsystem need optimizing.
|
|
Use JDBC for industrial-strength performance, Part 1
The JDBC API provides three principal methods for calling a database to extract information. System performance and ease of maintenance depend on the usage scenario you choose. Integrating a Java server application with a legacy database system is a nontrivial task; evaluating system-usage scenarios and server-side patterns is important for creating fast, robust application systems.
|
|
JDBC usage for industrial-strength performance, Part 2
Although you can create complex applications using the simple and easy-to-use design patterns of the JDBC API, you may gain better performance by allowing a single statement to return multiple ResultSets.
|
|
Increase the speed of your applications while reducing memory requirements
Object pooling allows the sharing of instantiated objects. Since different processes don't need to reinstantiate certain objects, there is no load time. And since the objects are returned to the pool, there is a reduction in garbage collection
|
|
Integrating Databases with Java via JDBC
The truth is that everything that you can do in C++, you can do in Java. And more. Java -- combined with JDBC, JavaSoft's database connectivity specification -- provides new means for communicating with databases through a system similar to that of C and C++ applications.
|
|
Scale an application from 2 to 3 tiers with JDBC
The Forum application that we created earlier this year is a pretty nifty bulletin-board system, but it needs some work if we want to make it a production-grade application. This month, we'll develop a JDBC communications layer that talks to a simple Microsoft SQL Server 6.5 database, and then build the layer into the server for the discussion forum. The resulting application will act as a JDBC-based middleware layer for the Forum application. You can apply this same technique to any networked Java application that needs to scale or that could benefit from talking to a database.
|
|
Reflections on Java, Beans, and relational databases
The 1.1 version of the Java Development Kit (JDK) contains new APIs for database access (JDBC) and components (JavaBeans). Together, these two APIs allow for the development of generic database code. A single class to access any JDBC database -- with the code specific to each individual application isolated in separate components. This means you won't have to update any database code with each minor change in a database's structure.
|
|
Access the world's biggest database with Web DataBase Connectivity
When Tony Loton speaks of "the world's biggest database" he means -- of course -- the World Wide Web. There's a lot of information out there, but have you ever wondered why the tool used to access it is called a browser? It's because all you're really doing is browsing. What if the World Wide Web really were a database; if each Webpage were a table that you could query using SQL or even JDBC? Then you wouldn't be limited to just browsing. Find out how Tony proposes to move you from Web browser to Web database
|
|
Dive into connection pooling with J2EE
Connection pooling is a technique used for sharing server resources among requesting clients. This article focuses on support for connection pooling of both database resources and nondatabase resources in a J2EE environment. Siva examines the JDBC 2.0, JMS 1.02, JNDI 1.2 Standard Extension APIs with regard to connection pooling and looks at some existing vendor implementations of those APIs. He then looks at the upcoming J2EE Connector Architecture 1.0 that would support a vendor-independent/pluggable approach to managing resource connections
|
|
JDBC drivers in the wild
In this article, we'll examine the basic architecture of the four different types of JDBC drivers and enumerate their pros and cons. In addition, we'll evaluate and compare five specific industry-standard drivers in terms of database access time, connection time, type of driver, and so forth. The drivers taken for comparison include JDBC-ODBC Bridge, IDS Driver, MERANT's SequeLink, JTurbo by Ashna, and I-net Sprinta 2000. Step-by-step instructions are given to deploy and use these drivers.
|
|
Duke's Bakery - A JDBCTM Order Entry Prototype - Part I
After a number of meetings with Kate, where she described her business and her goals, we settled on an approach. I would put together a rapid prototype so that she could begin using the application to provide a more refined set of requirements as her needs evolved.
|
|
Duke's Bakery, Part II
A JDBCTM Order Entry Prototype - Continued
In Duke's Bakery-Part I, I created a rapid prototype to show Duke's Bakery owner Kate Cookie how Java and JDBCTM technologies could be used to build an order entry system. Since then, Kate has taken a Java programming class, and has decided to start writing Java code herself, in addition to running her business.
|
|
How do access JDBCTM from JavaServer PagesTM?
I want to know how to access a database from a JSP? Can I use the JDBC coding inside the scriptlets, or does the JDBC code have to be done in Beans, where I am handling the data?
|
|
Browsing and Querying Databases
To illustrate more functionality of JavaServer Pages, we will build an example that allows you to select from available databases, see their tables and column names, and query them. Our JSP application will make use of a bean to access the database.
|
|
Adding Database Support With JDBC
In my earlier article The Nuts and Bolts of Relational Databases: A Primer for Web Developers, I explained the basics of relational databases. In this article, I'll describe how to use JDBC to add database support to your Java applications, applets, or servlets. If you've never developed database code in Java before, this article will help you get started.
|
|
Java Tip 38: The trick to "Iterator Observers"
Examples of the Iterator and Observer pattern can be found in most object-oriented systems and class libraries. Using these two patterns together to create Iterator Observers can help reduce code duplication and promote the degree to which software components depend on each other (coupling). The looser the coupling between components or subsystems the easy they are to interchange and maintain
|
|
Understanding JDBC Metadata
In the previous article in this series we stopped in the middle of building a set of classes that comprise a vendor-independent tool for maintaining database schemas. We had just introduced the concept of Metadata, and looked at how having an object representation of a set of database tables and columns can make it possible to modify and maintain them in an easy and flexible way.
|
|
Realm Configuration HOW-TO
This document describes how to configure Tomcat to support container managed security, by connecting to an existing "database" of usernames, passwords, and user roles. You only need to care about this if you are using a web application that includes one or more elements, and a element defining how users are required to authenticate themselves. If you are not utilizing these features, you can safely skip this document.
|
|
This article shows a simple ways of accessing spread sheets (such as microsoft excel) in java
This sample code was an outcome of a friend's requirement for reading an excel file dynamically. He had an EJB layer for a flight management system for read/writes to database.
|
|
DOM and JDBC - Structured Document Interchange and Processing - Fall 2001
The Document Object Model (DOM) Application Programming Interface (API).
|
|
Why Prepared Statements are important and how to use them "properly"
Databases have a tough job. They accept SQL queries from many clients concurrently and execute the queries as efficiently as possible against the data. Processing statements can be an expensive operation but databases are now written in such a way so that this overhead is minimized. However, these optimizations need assistance from the application developers if we are to capitalize on them. This article shows you how the correct use of PreparedStatements can significantly help a database perform these optimizations.
|