登陆模式:
1.在服务器端使用企业管理器,并且选择"使用 Windows 身份验证"连接上 SQL Server 
2.展开"SQL Server组",鼠标右键点击SQL Server服务器的名称,选择"属性",再选择"安全性"选项卡 
3.在"身份验证"下,选择"SQL Server和 Windows ". 
4.重新启动SQL Server服务. 

解决方案 »

  1.   

    在"身份验证"下,选择"SQL   Server和   Windows 我本来就是这样设置的
      

  2.   

    telnet 127.0.0.1 1433  能通吗??
      

  3.   

    我的代码是这样的
      public class Connection_jdbc
    {
        public Connection getConnection()
        {
            Connection conn=null;
            try
            {
                Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;databasename=t102" ,"sa", "");
                return conn;
            }
            catch (ClassNotFoundException ex)
            {
                System.out.println("连接发生错误!");
                ex.printStackTrace();
            }
            catch (SQLException ex1)
            {
                System.out.println("连接数据库发生错误!");
                ex1.printStackTrace();
            }
            return null;
        }}
    异常是
    连接数据库发生错误!
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    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(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at my1128_io.Connection_jdbc.getConnection(Connection_jdbc.java:12)
    at my1128_io.IO_Frame.getString(IO_Frame.java:58)
    at my1128_io.IO_Frame.textIO(IO_Frame.java:114)
    at my1128_io.IO_Frame.jButton1_actionPerformed(IO_Frame.java:152)
    at my1128_io.IO_Frame_jButton1_actionAdapter.actionPerformed(IO_Frame.java:164)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at my1128_io.IO_Frame.getString(IO_Frame.java:64)
    at my1128_io.IO_Frame.textIO(IO_Frame.java:114)
    at my1128_io.IO_Frame.jButton1_actionPerformed(IO_Frame.java:152)
    at my1128_io.IO_Frame_jButton1_actionAdapter.actionPerformed(IO_Frame.java:164)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
      

  4.   

    at   my1128_io.Connection_jdbc.getConnection(Connection_jdbc.java:12) 就是这里
     Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); 
                            conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;databasename=t102"   ,"sa",   "");