Java has an API for working with databases, and this technology is known as JDBC. JDBC provides the developer with tools that allow clients to connect to databases, and send commands to the database. These commands are written in the Structured Query Language. However, JDBC can be used with any kind of data base. That is because JDBC abstracts common database functions into a set of common classes and methods.
Database-specific code is contained in a code library, commonly called a driver library. If there is a driver library for a database, you can use the JDBC API to send commands to the database and extract data from the database.