Statement: getMaxFieldSize() : Statement « java.sql « Java by API






Statement: getMaxFieldSize()

 
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);

  }
}

           
         
  








Related examples in the same category

1.Statement.EXECUTE_FAILED
2.Statement.RETURN_GENERATED_KEYS
3.Statement.SUCCESS_NO_INFO
4.Statement: addBatch(String sql)
5.WebRowSet: execute(Connection conn)
6.Statement: executeBatch()
7.Statement: executeQuery(String sql)
8.Statement: getFetchSize()
9.Statement: getGeneratedKeys()
10.Statement: getMaxRows()
11.Statement: getQueryTimeout()
12.WebRowSet: setCommand(String cmd)
13.Statement: setFetchSize(int rows)