哥哥们啦,我有一个帅哥才能解决的问题啊!代码如下:
public Connection getConnection(){try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");this.con = DriverManager.getConnection(
"jdbc:jtds:sqlserver://127.0.0.1:1433/mylzs","sa","wxl");} catch (Exception e) {Logger.err("数据库连接失败");e.printStackTrace();
}return con;
}
我用的是SQL200,myeclipse始终报错如下:2011-08-22 16:07:38 156 [ ERROR ] [ Thread[main,5,main] ] [ com.lovo.serverDao.DBConnection.getConnection(DBConnection.java:40) ] 数据库连接失败
java.sql.SQLException: Network error IOException: Connection refused: connect
跪求答案啊。妹子菜菜啊。
public Connection getConnection(){try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");this.con = DriverManager.getConnection(
"jdbc:jtds:sqlserver://127.0.0.1:1433/mylzs","sa","wxl");} catch (Exception e) {Logger.err("数据库连接失败");e.printStackTrace();
}return con;
}
我用的是SQL200,myeclipse始终报错如下:2011-08-22 16:07:38 156 [ ERROR ] [ Thread[main,5,main] ] [ com.lovo.serverDao.DBConnection.getConnection(DBConnection.java:40) ] 数据库连接失败
java.sql.SQLException: Network error IOException: Connection refused: connect
跪求答案啊。妹子菜菜啊。
解决方案 »
- 日志对象是共用一个,还是建多个
- struts标签下拉列表取值的问题
- String s="abc";
- action中配置singleton出错
- JSP与SQLServer连接
- 如何用response.sendRedirect()把来自客户端的请求重定位到一个servlet上
- jsp显示问题
- 用java代码读取excel文档插入SQL Server数据库
- 各位大侠帮忙看看这个错误
- jsp里面怎么取得两个Date类型的时间间隔呢?精确到天就可以了:)
- 为什么我再MyEclipse里面部署好了Tomcat,每次修改源代码后都需要重新停止和启动Tomcat服务呢?
- 领导说,这个也太丑了吧。肿么才能导出这个样子的Excel啊
url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName =StoreManager";
user = "sa";
pwd = "xxxxxx";
con = DriverManager.getConnection(url,user,pwd);
SQLServerDriver在一个什么jar包里我忘了