一.連線oracle資料庫
class.forname("oracle.jdbc.driver.oracledriver").newinstance();
string url="jdbc:oracle:thin:@伺服器ip:1521:資料庫名稱";
connection conn=drivermanager.getconnection(url,"使用者名稱","密碼");
二.連線mssql資料庫
class.forname("com.microsoft.jdbc.sqlserver.sqlserverdriver").newinstance();
string url="jdbc:microsoft:sqlserver://localhost:1433;databasename=pubs";
六、jsp連線mysql資料庫 (com.mysql.jdbc.driver)
class.forname("org.gjt.mm.mysql.driver").newinstance();
string url ="jdbc:mysql://localhost/softforum?
user=soft&password=soft1234&useunicode=true&characterencoding=8859_1"
//testdb為你的資料庫名
connection conn= drivermanager.getconnection(url);
class.forname("com.informix.jdbc.ifxdriver").newinstance();
string url = "jdbc:informix-sqli:
user=testuser;password=testpassword";
//testdb為你的資料庫名
connection conn= drivermanager.getconnection(url);
statement stmt=conn.createstatement
五、jsp連線sybase資料庫
class.forname("com.sybase.jdbc.sybdriver").newinstance();
string url =" jdbc:sybase:tds:localhost:5007/tsdata";
//tsdata為你的資料庫名
properties sysprops = system.getproperties();
sysprops.put("user","userid");
sysprops.put("password","user_password");
connection conn= drivermanager.getconnection(url, sysprops);
5>jdbc_odbc橋
driver:
sun.jdbc.odbc.jdbcodbcdriver
connect_string:
jdbc:odbc:db
6>weblogic
driver:
weblogic.jdbc.pool.driver
connect_string:
jdbc:weblogic:mssqlserver4:northwind@localhost
Java資料庫連線字串
1 oracle8 8i 9i資料庫 thin模式 class.forname oracle.jdbc.driver.oracledriver newinstance string url jdbc oracle thin localhost 1521 orcl orcl為資料庫的sid strin...
Java資料庫連線字串
1 oracle8 8i 9i資料庫 thin模式 class.forname oracle.jdbc.driver.oracledriver newinstance string url jdbc oracle thin localhost 1521 orcl orcl為資料庫的sid strin...
Java連線RAC資料庫字串
jdbc oracle thin description address list address protocol tcp host 192.168.0.231 port 1521 address protocol tcp host 192.168.0.232 port 1521 load bal...