Question: how to extract data from database using java?
Answer: Load the JDBC driver, using the forName(String className) API method of the Class. ... 
Create a Connection to the database. ... 
Create a Statement, using the createStatement() API method of the Connection.
Execute the query to the database, using the executeQuery(String sql) API method.