MySQL
Class. forname ("com. MySQL. JDBC. Driver ");
Connection con = drivermanager. getconnection ("JDBC: mysql: // host: Port/Database", "user", "password ");
Oracle Database(Thin Mode)
Class. forname ("oracle. JDBC. Driver. oracledriver ");
Connection con = drivermanager. getconnection ("JDBC: oracle: thin: @ host: Port: Databse", "user", "password ");
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 ");
----------------------- The following are two types of bridge connections [JDBC-ODBC], without the need to add a third-party jar package ---------------------
// Not only can be used on the local machine, but also on the LAN without configuring the data source.
Class. forname ("Sun. JDBC. ODBC. jdbcodbcdriver ");
Conn = drivermanager. getconnection ("JDBC: ODBC: Driver = {SQL Server}; database = Suntech; server = 192.168.1.11", "sa", "123456 ");
// You need to configure the data source named AA, which can only be used on the local machine [this code will report an error when another machine uses this code]
Class. forname ("Sun. JDBC. ODBC. jdbcodbcdriver ");
Conn = drivermanager. getconnection ("JDBC: ODBC: AA, Server = 192.168.1.11", "sa", "123456 ");
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/inthirties/archive/2009/11/07/4782011.aspx