<tfoot id='VREqT'></tfoot>
      • <bdo id='VREqT'></bdo><ul id='VREqT'></ul>

      <i id='VREqT'><tr id='VREqT'><dt id='VREqT'><q id='VREqT'><span id='VREqT'><b id='VREqT'><form id='VREqT'><ins id='VREqT'></ins><ul id='VREqT'></ul><sub id='VREqT'></sub></form><legend id='VREqT'></legend><bdo id='VREqT'><pre id='VREqT'><center id='VREqT'></center></pre></bdo></b><th id='VREqT'></th></span></q></dt></tr></i><div id='VREqT'><tfoot id='VREqT'></tfoot><dl id='VREqT'><fieldset id='VREqT'></fieldset></dl></div>
    1. <legend id='VREqT'><style id='VREqT'><dir id='VREqT'><q id='VREqT'></q></dir></style></legend>
    2. <small id='VREqT'></small><noframes id='VREqT'>

        接收 SQLException “用户登录失败"连接到 SQL Server 2008

        Receiving SQLException quot;Login failed for userquot; connecting to SQL Server 2008(接收 SQLException “用户登录失败连接到 SQL Server 2008)
        <i id='Xw3hE'><tr id='Xw3hE'><dt id='Xw3hE'><q id='Xw3hE'><span id='Xw3hE'><b id='Xw3hE'><form id='Xw3hE'><ins id='Xw3hE'></ins><ul id='Xw3hE'></ul><sub id='Xw3hE'></sub></form><legend id='Xw3hE'></legend><bdo id='Xw3hE'><pre id='Xw3hE'><center id='Xw3hE'></center></pre></bdo></b><th id='Xw3hE'></th></span></q></dt></tr></i><div id='Xw3hE'><tfoot id='Xw3hE'></tfoot><dl id='Xw3hE'><fieldset id='Xw3hE'></fieldset></dl></div>
      1. <legend id='Xw3hE'><style id='Xw3hE'><dir id='Xw3hE'><q id='Xw3hE'></q></dir></style></legend>

            • <bdo id='Xw3hE'></bdo><ul id='Xw3hE'></ul>
              <tfoot id='Xw3hE'></tfoot>

                  <tbody id='Xw3hE'></tbody>

                <small id='Xw3hE'></small><noframes id='Xw3hE'>

                • 本文介绍了接收 SQLException “用户登录失败"连接到 SQL Server 2008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试通过 Java 连接到 SQL Server 2008.

                  1. 我已将 sqljdbc4.jar 添加到我的项目库中.
                  2. 没有为访问数据库的数据库设置用户名和密码(Windows 身份验证).
                  3. 1433 端口正在侦听,但我仍然收到此异常:

                  <块引用>

                  SQL 异常:com.microsoft.sqlserver.jdbc.SQLServerException:用户"登录失败.ClientConnectionId:085d5df3-ad69-49e1-ba32-b2b990c16a69

                  相关代码:

                  公共类数据库{私人连接链接;私有 java.sql.Statement stmt;公共结果集rs;公共数据库(){尝试{Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=DB;";连接 con = DriverManager.getConnection(connectionUrl);}捕获(SQLException e){System.out.println("SQL 异常:"+ e.toString());}捕获(ClassNotFoundException cE){System.out.println("找不到类异常:"+ cE.toString());}}}

                  解决方案

                  如果您想要 windows 身份验证,您需要将选项 integratedSecurity=true 添加到您的 JDBC URL:

                  <上一页>jdbc:sqlserver://localhost:1433;databaseName=DB;integratedSecurity=true

                  您还需要在您的 Windows 系统路径或通过 java.library.path 定义的目录中的 sqljdbc_auth.dll(注意 32/64 位)

                  有关详细信息,请参阅驱动程序手册:http://msdn.microsoft.com/en-us/library/ms378428.aspx#Connectingintegrated

                  I am trying to connect to SQL Server 2008 via Java.

                  1. I've added sqljdbc4.jar to my project's library.
                  2. No username and password is set for database accessing the database (Windows Authentication).
                  3. The 1433 port is Listening, but I still receive this exception:

                  SQL Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ''. ClientConnectionId:085d5df3-ad69-49e1-ba32-b2b990c16a69

                  Relevant code:

                  public class DataBases 
                  {
                  
                      private  Connection link;
                      private  java.sql.Statement  stmt;
                      public    ResultSet rs;
                  
                      public DataBases() 
                      {  
                          try 
                          {    
                              Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                              String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=DB;";
                              Connection con = DriverManager.getConnection(connectionUrl);
                          } 
                          catch (SQLException e) 
                          {
                              System.out.println("SQL Exception: "+ e.toString());
                          }
                          catch (ClassNotFoundException cE)
                          {
                              System.out.println("Class Not Found Exception: "+ cE.toString());
                          }
                       }
                  }
                  

                  解决方案

                  If you want windows authentication you need to add the option integratedSecurity=true to your JDBC URL:

                  jdbc:sqlserver://localhost:1433;databaseName=DB;integratedSecurity=true
                  

                  You also need sqljdbc_auth.dll (beware of 32/64 bit) in your Windows system path or in a directory defined through java.library.path

                  For details see the driver's manual: http://msdn.microsoft.com/en-us/library/ms378428.aspx#Connectingintegrated

                  这篇关于接收 SQLException “用户登录失败"连接到 SQL Server 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Compiling C++ for the JVM(为 JVM 编译 C++)
                  Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                  How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                  Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                  How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                  Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)
                  <i id='IntcA'><tr id='IntcA'><dt id='IntcA'><q id='IntcA'><span id='IntcA'><b id='IntcA'><form id='IntcA'><ins id='IntcA'></ins><ul id='IntcA'></ul><sub id='IntcA'></sub></form><legend id='IntcA'></legend><bdo id='IntcA'><pre id='IntcA'><center id='IntcA'></center></pre></bdo></b><th id='IntcA'></th></span></q></dt></tr></i><div id='IntcA'><tfoot id='IntcA'></tfoot><dl id='IntcA'><fieldset id='IntcA'></fieldset></dl></div>

                    <legend id='IntcA'><style id='IntcA'><dir id='IntcA'><q id='IntcA'></q></dir></style></legend>

                      • <bdo id='IntcA'></bdo><ul id='IntcA'></ul>

                          <tfoot id='IntcA'></tfoot>
                            <tbody id='IntcA'></tbody>

                          <small id='IntcA'></small><noframes id='IntcA'>