| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 943 人关注过本帖
标题:加载项目时数据库出错,大侠们帮我看看啊
取消只看楼主 加入收藏
huxiangwenhu
Rank: 4
等 级:业余侠客
威 望:1
帖 子:191
专家分:262
注 册:2010-6-1
结帖率:90.91%
收藏
已结贴  问题点数:40 回复次数:4 
加载项目时数据库出错,大侠们帮我看看啊
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Error establishing socket.
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
    at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
    at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at com.lzw.dao.Dao.<clinit>(Dao.java:41)
    at com.lzw.login.Login$2.actionPerformed(Login.java:54)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.(Component.java:6216)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.(Component.java:5981)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.(Component.java:4583)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.(Component.java:4413)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.(Component.java:4413)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at com.lzw.dao.Dao.getUser(Dao.java:120)
    at com.lzw.login.Login$2.actionPerformed(Login.java:54)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.(Component.java:6216)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.(Component.java:5981)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.(Component.java:4583)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.(Component.java:4413)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.(Component.java:4413)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
看见过很多这样的问题,我也照着他们的方法去试了,我的数据库是sql server 2000 SP3版本,端口1433也打开了,还是不能解决问题,求教各位大哥大姐,不甚感激!!!
搜索更多相关主题的帖子: 数据库 加载 项目 
2010-08-17 23:10
huxiangwenhu
Rank: 4
等 级:业余侠客
威 望:1
帖 子:191
专家分:262
注 册:2010-6-1
收藏
得分:0 
回复 2楼 shellingford
protected static String dbClassName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
    protected static String dbUrl = "jdbc:microsoft:sqlserver://localhost:1433;"
            + "DatabaseName=db_JXC;SelectMethod=Cursor";
    protected static String dbUser = "sa";
    protected static String dbPwd = "";
    protected static String second = null;
    public static Connection conn = null;
    static {
        try {
            if (conn == null) {
                Class.forName(dbClassName).newInstance();
                conn = DriverManager.getConnection(dbUrl, dbUser, dbPwd);
            }
        } catch (Exception ee) {
            ee.printStackTrace();
        }
    }
帮我看看有什么问题吗?
2010-08-18 11:14
huxiangwenhu
Rank: 4
等 级:业余侠客
威 望:1
帖 子:191
专家分:262
注 册:2010-6-1
收藏
得分:0 
回复 4楼 luoweijun
驱动包应该没问题啊,
图片附件: 游客没有浏览图片的权限,请 登录注册
,你看看,JDBC驱动包我一直都是用的这个..
2010-08-18 16:56
huxiangwenhu
Rank: 4
等 级:业余侠客
威 望:1
帖 子:191
专家分:262
注 册:2010-6-1
收藏
得分:0 
回复 5楼 shellingford
TCP/IP也启动了
2010-08-18 17:00
huxiangwenhu
Rank: 4
等 级:业余侠客
威 望:1
帖 子:191
专家分:262
注 册:2010-6-1
收藏
得分:0 
非常感谢楼上各位大哥的帮忙,正如6楼所说,把数据库升级到SP4就可以了,不过我还有一个问题,SP3为什么不行呢,我以前也做过一些小练习,一直都是用的SP3版本啊,为什么这个会要求SP4呢?
2010-08-18 17:12
快速回复:加载项目时数据库出错,大侠们帮我看看啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.042765 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved