⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testquerytimeout.java

📁 非常好的java事例以及带源码事例的java2教程
💻 JAVA
字号:
import java.sql.*;

public class TestQueryTimeOut
{
  public static void main(String[] args)
  {
    Statement statement = null;
    try
    {
      String url = "jdbc:odbc:technical_library";
      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);
    }
    catch (ClassNotFoundException cnfe)
    {
      System.out.println(cnfe);
    }
    catch (SQLException sqle)
    {
      System.out.println(sqle);
    }
    // Put each method call in a separate try block to execute them all
    try
    {
      System.out.print("\nMaximum rows    :");
      int maxRows = statement.getMaxRows();
      System.out.print(maxRows == 0 ? " No limit" : " " + maxRows);
    }
    catch (SQLException sqle)
    {
      System.err.print(sqle);
    }
    try
    {
      System.out.print("\nMax field size  :");
      int maxFieldSize = statement.getMaxFieldSize();
      System.out.print(maxFieldSize == 0 ? " No limit" : " " + maxFieldSize);
    }
    catch (SQLException sqle)
    {
      System.err.print(sqle);
    }
    try
    {
      System.out.print("\nTimeout          :" );
      int queryTimeout = statement.getQueryTimeout();
      System.out.print(queryTimeout == 0 ? " No limit" : " " + queryTimeout);
    }
    catch (SQLException sqle)
    {
      System.err.print(sqle);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -