oracle数据库连接固定语句

package cn.mldn.lxh.note.dbc;

import java.sql.*;

public class DataBaseConnection {
 private String DBDRIVER="oracle.jdbc.driver.OracleDriver";
 private String DBURL="jdbc:oracle:thin:@localhost:1521:MLDN";
 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.close();
  } catch (RuntimeException e) {
   // TODO 自动生成 catch 块
   e.printStackTrace();
  }
 }
 
}

你可能感兴趣的:(oracle数据库连接固定语句)