jdbc連線資料庫大全

2021-09-30 08:44:39 字數 3924 閱讀 1775

jdbc

裡統一的使用方法

class.for(jdbcdrivername);

connection conn= drivermanager.getconnection(url,user,password);

這裡的介面是統一的,不同的是每種資料庫提供的

jdbcdriver

和url

不同mysql

class.forname("com.mysql.jdbc.driver");

connection con = drivermanager.getconnection("jdbc:mysql://host:port/database","user","password");

oracle

資料庫(

thin

模式)

class.forname("oracle.jdbc.driver.oracledriver");

connection con = drivermanager.getconnection("jdbc:oracle:thin:@host:port:databse","user","password");

timesten

資料庫(

thin

模式)

class.forname("com.timesten.jdbc.timestendriver");

connection con = drivermanager.getconnection("jdbc:timesten:client:dsn=dsnname")

microsoft sql server

class.forname("net.sourceforge.jtds.jdbc.driver ");

connection con = drivermanager.getconnection("jdbc:jtds:sqlserver://host:port/database","user","password");

or connection con = drivermanager.getconnection("jdbc:jtds:sybase://host:port/database","user","password");

db2

firebird

class.forname("org.firebirdsql.jdbc.fbdriver");

connection con = drivermanager.getconnection("jdbc:firebirdsql://host:port/fdb_file_path","user","password");

pointbase(server)

class.forname("com.pointbase.jdbc.jdbcuniversaldriver");

connection con = drivermanager.getconnection("jdbc:pointbase:server://host:port/databasename","user","password");

hsqldb(server)

class.forname("org.hsqldb.jdbcdriver");

connection con = drivermanager.getconnection("jdbc:hsqldb:hsql://localhost:port/mydb","user","password");

derby

這個少有人聽說吧,

cloudscape

應該聽說過吧,該專案由此衍生

class.forname("org.apache.derby.jdbc.clientdriver");

connection con = drivermanager.getconnection("jdbc:derby://host:port//mydb","user","password");

class.forname("org.apache.derby.jdbc.embeddeddriver");

connection conn = drivermanager.getconnection("jdbc:derby:mynewdb", p);

cloudscape

class.forname("com.cloudscape.core.jdbcdriver");

connection conn = drivermanager.getconnection("jdbc:cloudscape:");

class.forname("com.cloudscape.rmijdbc.rjdriver");

connection conn = drivermanager.getconnection("jdbc:rmi://:/jdbc:cloudscape:", user, passoword);

postgresql

class.forname("org.postgresql.driver");

connection con=drivermanager.getconnection("jdbc:postgresql://host:port/database","user","password");

informix

class.forname("com.informix.jdbc.ifxdriver").newinstance();

connection con=drivermanager.getconnection("jdbc:informix-sqli://host:port/mydb:informixserver=myserver","user","password");

access

class.forname("sun.jdbc.odbc.jdbcodbcdriver") ;

connection con=drivermanager.getconnection("jdbc:odbc:driver=;dbq=mdb

的檔案路徑

","user","password");

sybase

class.forname("com.sybase.jdbc2.jdbc.sybdriver").newinstance();

connection con=drivermanager.getconnection("jdbc:sybase:tds:host:port?servicename=databasename","user","password");

jdbc連線資料庫大全

鏈結 sql資料庫 class.forname com.microsoft.jdbc.sqlserver.sqlserverdriver string url jdbc microsoft sqlserver 192.168.100.9 1433 databasename asset string ...

JDBC連線資料庫大全

常用jdbc連線資料庫方法總結如下 一 jdbc連線db2 class.forname com.ibm.db2.jdbc.net.db2driver string url jdbc db2 dburl port dbname cn drivermanager.getconnection url,su...

JDBC連線資料庫

雖然現在用很多方法來實現應用程式與資料庫後台的連線操作,但是做為一名新手,真正理解和掌握使用jdbc來連線資料庫是非常有必要的,因為它是基礎。下面就說說如何實現jdbc連線資料庫。url jdbc mysql localhost 3306 bookmanage?useunicode true cha...