Skip to main content

Posts

Showing posts from December, 2022

Java database connection(JDBC)

Chapter 7 Database connection Java is a software development tool used to make Web, desktop and mobile applications. Databases are the central component for dynamic content, so Java supports connecting to the database. JDBC allows you to connect to a wide-range of databases (Oracle,MySQL, etc), but we're going to use the in-built database you get with the Java/NetBeans software. The database is called Java DB, a version ofApache Derby. Basic steps to use a database in Java 1.Establish a connection 2.Create JDBC Statements 3.Execute SQL Statements 4.GET ResultSet 5.Close connections 1. Establish a connection import java.sql.*; Load the vendor specific driver Class.forName("org.apache.derby.jdbc.ClientDriver"); What do you think this statement does, and how? Dynamically loads a driver class, for Java DB database ...