Source code: gsoft/sql/OrclConn.java
1 /*************************************************************************
2 Copyright (C) 2003 Steve Gee
3 stevesgee@cox.net
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *************************************************************************/
19
20 package gsoft.sql;
21
22 import java.sql.Connection;
23 import java.sql.SQLException;
24 import java.sql.DriverManager;
25 //import oracle.jdbc.driver.OracleDriver;
26
27 public class OrclConn implements ConnectionInterface{
28
29 private Connection CurrConn;
30
31 public OrclConn(){
32 try{
33 //do nothing
34 }catch(Exception e){
35 System.out.println("ORACLE_DRIVER_LOADER_ERROR: " + e);
36 }
37 }
38
39 public Connection getConn(String host, String port, String sid, String user, String psword)
40 throws Exception{
41 Class.forName("oracle.jdbc.OracleDriver");
42 CurrConn = DriverManager.getConnection("jdbc:oracle:thin:" + user + "/" + psword + "@" + host + ":" + port + ":" + sid);
43 return CurrConn;
44 }
45
46 public void closeConn() throws SQLException {
47 CurrConn.close();
48 }
49 }