jdbc连接mysql数据库时出现了如下问题,求各位大神帮帮忙
2个回答
2016-05-22
展开全部
package com.bl.db;
import java.sql.DriverManager;
import java.sql.SQLException;
import com.blog.port.*;
import java.sql.*;
public class DBTool implements IDBTool {
Connection conn;
public Connection getConn(){
try {
DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;databasename=Data","sa","");
} catch (SQLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
return conn;
import java.sql.DriverManager;
import java.sql.SQLException;
import com.blog.port.*;
import java.sql.*;
public class DBTool implements IDBTool {
Connection conn;
public Connection getConn(){
try {
DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;databasename=Data","sa","");
} catch (SQLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
return conn;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询