If all we need to do is keep information around and prevent it from vanishing when we turn off our computers, we could just simply put in a file on a hard drive. If we were delivering newspapers, we might start out needing only a list of the addresses of where to deliver the papers. However, if our needs expanded for instance, if we wanted names and payment information as well as delivery addresses, we would begin to see the need for more sophisticated data management. This is where database systems have a role, as they help us organize the information we collect. The first of three main database architectures is the relational database. The vast majority of databases are of this sort. Relational databases store data in a row and column model, much like a spreadsheet. The individual columns are called fields, and the rows are called records. The entire collection of rows is usually referred to as a table. A new language, Structured Query Language (SQL and pronounced "see-quil"), was created for working with this relational way of modeling data.
Object-Oriented Databases:
The second major type of DBMS is object-oriented. This type stores objects rather than records. The objects it stores are like Java classes, a combination of both data and methods for manipulating that data.
This is very different than the relational approach, where you only store the data, and the manipulation of that data is left to a procedural process. The object-oriented type of DBMS is typically not supported by JDBC.
Object-Oriented Database
An object-oriented database is a database management system in which data is represented in the form of objects, as opposed to using a relational model or a hierarchical model. Some characteristics of object-oriented databases include:
Data is represented using objects: In an object-oriented database, data is stored in the form of objects, which are self-contained units that encapsulate both data and behavior.
Objects have relationships with other objects: Objects in an object-oriented database can have relationships with other objects, allowing for the creation of complex data structures.
Objects have inheritance and polymorphism: Objects in an object-oriented database can inherit characteristics from parent objects and can exhibit polymorphism, which means that they can take on different forms depending on their context.
Supports encapsulation: Encapsulation is a key principle of object-oriented programming, and object-oriented databases support this principle by allowing objects to hide their internal data and behavior from the outside world.
Persistence: An object-oriented database is designed to store objects in a persistent manner, meaning that the objects are stored permanently and can be retrieved at any time.
Object-Relational Database: The third type of database is a hybrid of the previous two, called an object-relational database. It combines characteristics of both. Like relational systems, it might support the SQL language, and like object-oriented systems, it allows for the storage of objects. Often, relational database vendors will create extensions to their systems to support storing objects.
Again, JDBC is largely oriented to the relational model. Vendor-specific extensions might allow an application to support these object-oriented features, but, as such, those features are not portable across every DBMS. The following series of images illustrates the various databases and their functions.
How to transform a list to a Database Table
Database Management System Types
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 the SQL (Structured Query Language). Data and metadata (data about data/information) are at the heart of most business applications, and JDBC deals with data and metadata stored and manipulated in relational database systems (RDBMSs). Note that each RDBMS has a lot of metadata, and JDBC maps some of those metadata in a uniform and consistent fashion by its API.
Question: What is the purpose of the DatabaseMetaData Interface in Java SE 8?
The DatabaseMetaData interface in Java SE 8 provides a standard way for Java applications to retrieve metadata about the database they are connected to through the JDBC API. Metadata refers to data about the database itself, such as the names of tables and columns, the data types of columns, and the capabilities of the database. The DatabaseMetaData interface allows applications to retrieve this information at runtime, which can be useful for building dynamic and flexible applications that can adapt to different databases.
The DatabaseMetaData interface provides methods to retrieve information about the database's structure, such as the names of tables, columns, and indexes, as well as information about the database's capabilities, such as whether it supports transactions or stored procedures. It also provides methods to retrieve information about the JDBC driver being used to connect to the database. By using the DatabaseMetaData interface, Java applications can retrieve important information about the database they are connected to and use that information to adapt to the database's structure and capabilities. This can make it easier to build portable and flexible applications that can work with a variety of databases without needing to hard-code specific details about each database.
In the next lesson, relational databases will be discussed.