java连接数据库出错啦..高手帮我解决一下啊..谢了
packagedao;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.SQLE...
package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class BaseDAO {
//获得驱动
private String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
//获得URL
private String url = "jdbc:sqlserver://localhost:1434;databaseName=fuchsin";
//用户名
private String uName = "sa";
//密码
private String pwd = "34";
protected Connection getCon(){
Connection con = null;
try {
//载人驱动
Class.forName(driver);
//得到连接
con = DriverManager.getConnection(url,uName,pwd);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return con;
}
public static void main(String[] args) {
BaseDAO basedao = new BaseDAO();
System.out.println(basedao.getCon());
}
}
.'
谢谢各位高手详细指点一下..
最好不用SSL连接..以前都没听说过SSL
还没学过 展开
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class BaseDAO {
//获得驱动
private String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
//获得URL
private String url = "jdbc:sqlserver://localhost:1434;databaseName=fuchsin";
//用户名
private String uName = "sa";
//密码
private String pwd = "34";
protected Connection getCon(){
Connection con = null;
try {
//载人驱动
Class.forName(driver);
//得到连接
con = DriverManager.getConnection(url,uName,pwd);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return con;
}
public static void main(String[] args) {
BaseDAO basedao = new BaseDAO();
System.out.println(basedao.getCon());
}
}
.'
谢谢各位高手详细指点一下..
最好不用SSL连接..以前都没听说过SSL
还没学过 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询