Advertisement

Google Ad Slot: content-top

JDBC Setting Up

~1 min read · Java
On this page

To use JDBC (Java Database Connectivity), follow these steps to set up your development environment and establish a connection to a database.

Prerequisites:

Before setting up JDBC, ensure you have:

✅ Java Development Kit (JDK) installed

✅ Database installed (MySQL, PostgreSQL, Oracle, etc.)

✅ JDBC Driver for your database

✅ IDE (Eclipse, IntelliJ, or VS Code) or terminal


Download JDBC Driver:

Each database requires a specific JDBC driver. Download the driver for your database:

🔹 MySQL: MySQL Connector/J

🔹 PostgreSQL: PostgreSQL JDBC Driver

🔹 Oracle: Oracle JDBC Driver

🔹 SQL Server: Microsoft JDBC Driver


Add JDBC Driver to Your Java Project:

Depending on your development environment, add the JDBC driver:

📌 Using Command Line (For Manual Execution)

Place the JDBC driver .jar file in the same folder as your Java file and compile/run using:

javac -cp ".;mysql-connector-java-8.0.33.jar" MyJDBCApp.java java -cp ".;mysql-connector-java-8.0.33.jar" MyJDBCApp