java连接sqlserver
import java.sql.*;
public class TestDB {
public static void main(String[] args) {
String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbURL = "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=pubs";
String userName = "sa";
String userPwd = "";
Connection dbConn
try {
Class.forName(driverName);
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
System.out.println("Connection Successful!");
}
Catch (Exception e) {
e.printStackTrace();
}
}
}
java连接mysql
import java.sql.*;
public class SampleIntro
{
}
java连接oracle
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)
![](http://cms.it168.com/Images/OutliningIndicators/None.gif)