In view of many editions to find JDBC Driver or how to use Driver often ask, I will simply organize representative Driver and use ways. Microsoft SQL Server Series (6.5, 7.x and 2000) and Sybase 10JDBC Name: JTDSURL: htdsurl: http://jtds.SourceForge.Net/Version: 0.5.1download URL: http://sourceforge.net/project/showfiles.php?group_id=33291 Syntax: Class.Forname ("Net.SourceForge.jtds.jdbc .Driver "); connection con = DriverManager.getConnection (" JDBC: JTDS: SQLSERVER: // Host: Port / Database "," User "," Password "); Orconnection Con = DriverManager.getConnection (" JDBC: JTDS: Sybase : // Host: Port / Database "," User "," password "); mysqljdbc name: connection: http://www.mysql.com/Version:
3.0.8-stable
Download URL: http://www.mysql.com/downloads/api-jdbc-stable.html Syntax: Class.Forname ("com.mysql.jdbc.driver); connection con = drivermanager.getConnection (" JDBC: mysql : // Host: Port / Database "," User "," Password "); OracleJDBC Name: Connector / J 3.0URL: http://otn.oracle.com/Version:
3.0.8-stable
Download Url: http://otn.racle.com/software/tech/java/sqlj_jdbc/content.html Syntax: Class.Forname ("Oracle.jdbc.driver.Oracledriver); Connection Con = DriverManager.getConnection (" JDBC) : Oracle: Thin: @Host: Port: Database "," User "," Password "); SybaseDriver: JConnect 4.5 / 5.5 (JDBC 2.0 Please use 5.5) Syntax: Class.Forname (" com.sybase.jdbc2.jdbc. Sybdriver "). NewInstance (); DriverManager.getConnection (" JDBC: Sybase: TDS: IP Address: 2638? ServiceName = " Database Name," Account "," Password "); PostgreSQLJDBC Name: PostgreSQL JDBCURL: http: // JDBC.POSTGRESQL.ORG/Version:
7.3.3 BUILD 110
Download URL: http://jdbc.postgreSql.org/download.html Syntax: Class.Forname ("Org.PostgreSql.driver); Connection Con = DriverManager.getConnection (" JDBC: PostgreSQL: // Host: Port / Database "," user "," password "); IBM AS400 host is using the JDBC syntax with a V4R4 or more version of Client Access Express can find Driver file JT400.ZIP in C: / Program Files / IBM / Client Access / JT400 / lib And change the extension to become JT400.jar syntax java.sql.driverManager.registerDriver (new com.ibm.as400.access.as400jdbcdriver ()); class.forname ("com.ibm.as400.access.as400jdbcconnection); conn = DriverManager.getConnection ("JDBC: AS400: // IP", "User", "Password"); Someok Posted on 2004-04-25 02:52 | Quote (Trackback0)
□ Comment
Oracle8i is finished, there is such an example in C: /oracle/ora81/jdbc/demo/demo.zip, I use it more than it is better!
Public static void main (string args [])
Throws SQLEXCEPTION
{
OracleConnectionCacheImpl ODS = New OracleConnectionCacheImpl ();
String Url = "JDBC: Oracle: OCI8: @";
Try {
String Url1 = System.getProperty ("JDBC_URL");
IF (URL1! = NULL)
URL = URL1;
} catch (exception e) {
// if there is any security exception, ignore it
// and use the default
}
ODS.SETURL (URL);
ODS.SETUSER ("Scott");
ODS.SETPASSWORD ("Tiger");
// set the max limit
ODS.SETMAXLIMIT (3);
Connection conn1 = NULL;
CONN1 = ODS.GETCONNECTION ();