Java

Log4j

== Introduction ==

[http://logging.apache.org/log4j/docs/ Log4J] is a logging framework developed as part of the Jakarta project and distributed under the Apache Sowtware Licens. The Log4J framework gives you a fully configurable logging environment for your applications. It can easily be configured through code in your program or using configuration files.

The basic architecture of Log4J consists of 3 main components:

Tags: 

JDBCInfo

Here is a small Java application which connects to a database using JDBC and prints some information.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
 
public class JDBCInfo {
    private Connection conn;
    
    public JDBCInfo(String driver, String url) {
        if (driver != null) {
            try {
                Class.forName(driver);
                System.out.println("Registered JDBC driver '" + driver + "'");
            } catch (ClassNotFoundException e) {

Pages