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

📄 dbaseconnection.java

📁 一个用java写的地震分析软件(无源码)
💻 JAVA
字号:

/**
 * DbaseConnection.java
 *
 *
 * Created: Tue Feb  8 16:05:34 2000
 *
 * @author Doug Given
 * @version
 */
package org.trinet.eventmatch;
//import sqlj.runtime.ref.DefaultContext;
//import oracle.sqlj.runtime.Oracle;
import oracle.jdbc.driver.*;
import oracle.sql.*;
import java.sql.*;
import java.util.*;

public class DbaseConnection  {

    /** The dbase connection */
    static public Connection conn = null;


    private DbaseConnection() {

    }
  /**
   * Make a connection. If we are running in the context of the Oracle server,
   * make the "default" connection to the local environment. Otherwise, use
   * the hardwired info which is used for testing outside the server.
   */

    public static Connection create ()
    {

      if (conn != null) return conn;	// already a connection

      try {
	// not executing in server
	if (System.getProperty ("oracle.server.version") == null)
	  {
	    String driverName = "oracle.jdbc.driver.OracleDriver";
	    String url = "jdbc:oracle:thin:@quake.gps.caltech.edu:1521:quakedb";

	    // TODO: get from a properties file?
	    // NOTE: changing this only affect command line modules and does
	    // not affect server modules.
	    String user = "trinetdb";
	    String passwd = "calgs";

	    Class.forName(driverName);
	    conn = DriverManager.getConnection(url, user, passwd);

	  // executing in server
	  } else {
	    conn = new OracleDriver().defaultConnection();	// in server
	  }


      }
      catch (ClassNotFoundException ex) {
            System.err.println("Cannot find the database driver classes.");
            System.err.println(ex);
        }
  catch (SQLException ex) {
            ex.printStackTrace(System.out);
	}
        catch (Exception ex) {
            ex.printStackTrace ();
        }

	return conn;
    }

} // DbaseConnection

⌨️ 快捷键说明

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