These two days connect MySQL and SQL server2008 code separately in Java. It was all wrong at the beginning. Now find the code that successfully connects on your machine:
1. mysql
Class.forName ("Com.mysql.jdbc.Driver"). newinstance ();
String url= "jdbc:mysql://localhost:3306/website? Characterencoding=utf8";//website is the database name. Read Chinese characters in MySQL
String user= "root";//Login to MySQL username and password
String pwd= "123456";
Con=drivermanager.getconnection (URL,USER,PWD);
2. SQL server2008
Class.forName ("com.microsoft.sqlserver.jdbc.SQLServerDriver"). newinstance ();
String url= "jdbc:sqlserver://localhost:1433;databasename=website";
String user= "SA"; //Login to SQL Server username and password
String pwd= "123456";
Con=drivermanager.getconnection (URL,USER,PWD);
Java connection mysql and SQL server2008 code