数据库连接全攻略:
public static Connection getConnection()
throws SQLException,IOException
{
Properties props = new Properties();
FileInputStream in = new FileInputStream("database2.properties");
props.load(in);
in.close();
String drivers = props.getProperty("jdbc.drivers");
if(drivers != null)
System.setProperty("jdbc.drivers", drivers);
String url = props.getProperty("jdbc.url");
String username = props.getProperty("jdbc.user");
String password = props.getProperty("jdbc.password");
System.out.println("1111"+url+username+drivers);
return DriverManager.getConnection(url,username,password);
}
public static Connection getConnection()
throws SQLException,IOException
{
Properties props = new Properties();
FileInputStream in = new FileInputStream("database2.properties");
props.load(in);
in.close();
String drivers = props.getProperty("jdbc.drivers");
if(drivers != null)
System.setProperty("jdbc.drivers", drivers);
String url = props.getProperty("jdbc.url");
String username = props.getProperty("jdbc.user");
String password = props.getProperty("jdbc.password");
System.out.println("1111"+url+username+drivers);
return DriverManager.getConnection(url,username,password);
}
jdbc.drivers=com.sybase.jdbc2.jdbc.SybDriver
logfile=d:\\db2xml\\DBLog.txt
jdbc.url=jdbc:sybase:Tds:200.100.100.119:5000/ec
jdbc.user=sa
jdbc.password=
bbs.maxconn=100
bbs.libname=
bbs.flag=1
jdbc.dbname=ec
bbs.dept=1这个是连SYBASE的!!!.....
public abstract interface OracleConnection extends Connection
OracleConnection 仍然是一个接口,实现的代码不是写在哪里面,到底写在哪个类里面呢?
老兄,你都两个颗星了还来抢生意呀?
:)
public class OracleConnection
implements oracle.jdbc.internal.OracleConnection, ClientDataSupport
oracle.jdbc.internal.OracleConnection 继承(extends)了刚才oracle.jdbc.OracleConnection,但有个新问题,abstract interface这是干啥的,它和interface有什么不同吗
都在class12.jar里的,你仔细找找不就行了,oracle.jdbc.OracleConnectionWrapper
oracle.jdbc.driver.OracleConnection
还有几个你找找吧,呵呵.