JDBC / NOTES</>↗JDBC11 Jan 2026
To connect to an Oracle database using JDBC, you’ll need the Oracle JDBC driver (typically ojdbc8.jar or later) and a connection string formatted as a Thin URL. Here is the step-by-step process and a code example. 1. Add the Dependency If you are using Maven, add the ojdbc dependency to your pom.xml. For Java 11+, […]
JDBC / NOTES</>↗JDBC11 Jan 2026
To connect to a PostgreSQL database using JDBC, you’ll need the PostgreSQL JDBC driver and a properly formatted connection URL. 1. Add the Dependency Add the following dependency to your pom.xml file: <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>42.7.4</version> </dependency> 2. Establish the Connection In modern JDBC (4.0+), you no longer need to manually call Class.forName(). The DriverManager […]
JDBC / NOTES</>↗JDBC10 Jan 2026
Connecting to a MySQL database using JDBC involves a few straightforward steps: adding the driver, defining your connection credentials, and using the DriverManager to open a session. 1. Add the MySQL Connector Dependency First, ensure you have the MySQL JDBC driver in your project. If you are using Maven, add this to your pom.xml: <dependency> […]
JDBC / NOTES</>↗JDBC10 Jan 2026
Setting up JDBC (Java Database Connectivity) involves a few key steps: adding the database driver to your project, establishing a connection, and executing your SQL statements. 1. Add the JDBC Driver Dependency First, you need the driver for your specific database (e.g., MySQL, PostgreSQL, H2) in your pom.xml. For MySQL, you would add: <dependency> <groupId>com.mysql</groupId> […]
HTTPCLIENT / NOTES</>↗HttpClient09 Jan 2026
In modern Java, using JSON libraries like Jackson or Gson is the standard way to handle data exchange, as the Java Standard Library does not include a built-in JSON parser. With Java 25, you can take advantage of Records for clean data models and Text Blocks for readable JSON strings in your code. 1. Using […]
NET PACKAGE / NOTES</>↗Net Package09 Jan 2026
To resolve a hostname to an IP address (or vice versa) in Java, you use the java.net.InetAddress class. This class provides static factory methods to perform DNS lookups. Here are the most common ways to use it: 1. Resolve a Hostname to an IP Address Use InetAddress.getByName(String host) to get the primary IP address associated […]