import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class Main {
public static void main(String[] args) throws Exception {
Statement statement = null;
String url = "jdbc:odbc:databaseName";
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String username = "guest";
String password = "guest";
Class.forName(driver);
Connection connection = DriverManager.getConnection(url, username, password);
statement = connection.createStatement();
System.out.println("Driver : " + driver);
// Put each method call in a separate try block to execute them all
System.out.print("\nMaximum rows :");
int maxRows = statement.getMaxRows();
System.out.print(maxRows == 0 ? " No limit" : " " + maxRows);
System.out.print("\nMax field size :");
int maxFieldSize = statement.getMaxFieldSize();
System.out.print(maxFieldSize == 0 ? " No limit" : " " + maxFieldSize);
System.out.print("\nTimeout :");
int queryTimeout = statement.getQueryTimeout();
System.out.print(queryTimeout == 0 ? " No limit" : " " + queryTimeout);
}
}
|