Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;

public class Main {
    private static final String DRIVER = "com.mysql.jdbc.Driver";

    private static final String URL = "jdbc:mysql://localhost/yourDatabase";

    private static final String USERNAME = "root";

    private static final String PASSWORD = "";

    public static void main(String[] args) throws Exception {
        Class.forName(DRIVER);
        Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
        DatabaseMetaData metadata = connection.getMetaData();

        boolean supportForwardOnly = metadata.supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY);
        System.out.println("supportForwardOnly = " + supportForwardOnly);

        boolean supportScrollInsensitive = metadata.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE);
        System.out.println("supportScrollInsensitive = " + supportScrollInsensitive);

        boolean supportScrollSensitive = metadata.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE);
        System.out.println("supportScrollSensitive = " + supportScrollSensitive);
        connection.close();
    }
}