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

📄 dbffiledriver.java

📁 有关JDBC的使用一些编程实例,有关与数据库连接的代码
💻 JAVA
字号:
/* * * dbfFile/tinySQL JDBC driver * * A lot of this code is based on or directly taken from * George Reese's (borg@imaginary.com) mSQL driver. * * So, it's probably safe to say: * * Portions of this code Copyright (c) 1996 George Reese * * The rest of it: * * Copyright 1996 John Wiley & Sons, Inc. All Rights Reserved. Reproduction * or translation of this work beyond that permitted in Section 117 of the 1976 * United States Copyright Act without the express written permission of the * copyright owner is unlawful. Requests for further information should be  * addressed to Permissions Department, John Wiley & Sons, Inc. The  * purchaser may make back-up copies for his/her own use only and not for  * distribution or resale. The Publisher assumes no responsibility for errors,  * omissions, or damages, caused by the use of this  software or from the use * of the information contained herein. * */import java.sql.Connection;import java.sql.DriverPropertyInfo;import java.sql.SQLException;import java.sql.Driver;import java.util.Properties;    public class dbfFileDriver extends tinySQLDriver {  /*   *   * Instantiate a new dbfFileDriver(), registering it with   * the JDBC DriverManager.   *   */  static {    try {      java.sql.DriverManager.registerDriver(new dbfFileDriver());    } catch (Exception e) {      e.printStackTrace();    }  }  /**   *   * Constructs a new dbfFileDriver   *   */  public dbfFileDriver() {    super();  }  /**   *   * returns a new dbfFileConnection object, which is cast   * to a tinySQLConnection object.   *   * @exception SQLException when an error occurs   * @param user the username - currently unused   * @param url the url to the data source   * @param d the Driver object.   *   */  public tinySQLConnection getConnection                 (String user, String url, Driver d)                   throws SQLException {    return (tinySQLConnection) new dbfFileConnection(user, url, d);  }  /**   *   * Check to see if the URL is a dbfFile URL. It should start   * with jdbc:dbfFile in order to qualify.   *   * @param url The URL of the database.   * @return True if this driver can connect to the given URL.   *   */  public boolean acceptsURL(String url) throws SQLException {    // make sure the length is at least twelve    // before bothering with the substring    // comparison.    //    if( url.length() < 12 ) {      return false;    }    // if everything after the jdbc: part is    // dbfFile, then return true.    //    return url.substring(5,12).equals("dbfFile");  }}

⌨️ 快捷键说明

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