java 读写EXCEL文件的源码

源代码在线查看: dbconnection.java

软件大小: 89 K
上传用户: jill
关键词: EXCEL java 读写 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

				/********************************************************************
				 *
				 * $RCSfile: DBConnection.java,v $  $Revision: 1.1 $  $Date: 2003/09/22 08:06:24 $
				 *
				 * $Log: DBConnection.java,v $
				 * Revision 1.1  2003/09/22 08:06:24  icestone
				 * init
				 *
				 *
				 *
				 **********************************************************************/
				 
				package pcdmupgradedata;
				
				/**
				 * Title: 数据库连接类
				 * Description: 
				 * Copyright: Copyright (c) 2003/05/23
				 * Company: 
				 * @author Peter
				 * @version 1.0
				 */
				import java.sql.*;
				
				public class DBConnection {
				  private String strIP = null;       //数据库IP地址
				  private String strSID = null;      //SID
				  private String strUser = null;     //用户名
				  private String strPassword = null; //密码
				
				  public DBConnection() {
				  }
				
				  public void setConnectString(String strIP,String strSID,String strUser,String strPassword){
				    this.strIP = strIP;
				    this.strSID = strSID;
				    this.strUser = strUser;
				    this.strPassword = strPassword;
				  }
				
				  public Connection getConnection(){
				    //获取数据库连接对象
				
				    Connection conn = null;
				    try {
				      Class.forName("oracle.jdbc.driver.OracleDriver");
				    }
				    catch(ClassNotFoundException e) {
				      System.out.println("Can't find class oracle.jdbc.driver.OracleDriver");
				      System.exit(1);
				    }
				
				    try {
				      conn = DriverManager.getConnection(
				          "jdbc:oracle:thin:@" + strIP + ":1521:" + strSID,strUser,strPassword);
				    }
				    catch(SQLException e) {
				      System.out.println("SQL error: " + e.toString());
				    }
				    return conn;
				  }
				
				  public void closeConnection(Connection conn){
				    //关闭数据库连接
				    if (conn != null)
				        try {conn.close();} catch(SQLException ignore) {}
				  }
				
				}			

相关资源