//DataBaseConnection.java
package com.lbq.jdbc ;
import java.sql.* ;
//主要功能是连接数据库和关闭数据库.
public class DataBaseConnection
{
private String DBDRIVER = "oracle.jdbc.driver.OracleDriver" ;
private String DBURL = "jdbc:oracle:thin:@localhost:1521:test" ;
private String DBUSER = "scott" ;
private String DBPASSWORD = "tiger" ;
private Connection conn = null ;
public DataBaseConnection(){
   try
   {
    Class.forName(DBDRIVER) ;
    this.conn = DriverManager.getConnection(DBURL , DBUSER , DBPASSWORD) ;
   }
   catch (Exception e)
   {
   
   }
}
//取得数据库的连接.
public Connection getConnection(){

   return this.conn ;
}
//关闭数据库连接.
public void close(){
   try
   {
    this.conn.close();
   }
   catch (Exception e)
   {
   }
  
}