import java.sql.*;
import java.util.*;
public class DbConn
{
private static Connection m_Conn = null;
public DbConn(String dbDriver, String dbUrl, String userName, String userPwd) throws Exception
{
try
{
Class.forName(dbDriver);
m_Conn = DriverManager.getConnection(dbUrl, userName, userPwd);
}
catch(Exception ex)
{
throw new Exception("sadfsds出错了:"
+ ex);
}
}
public void DbClose() throws Exception
{
if(m_Conn != null)
{
try
{
m_Conn.close();
}
catch(SQLException ex)
{
throw new Exception(ex);
}
}
}
public static void main(String[] args)
{
try
{
DbConn conn = new DbConn("oracle.jdbc.driver.OracleDriver",
"jdbc
racle:thin
172.18.2.78:1521:zhibss",
"gzibss",
"gzibss"
;
}
catch(Exception ex)
{
System.out.println("error: "
+ ex);
}
}
}