java - Java 运行时环境检测到 fatal error - Microsoft SQL Server

标签 java sql-server fatal-error

我有一个java应用程序应该连接到Microsoft SQL Server..我使用JRE 1.8和sqljdbc4-2.0.jar..当我尝试运行时:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006f41dd27, pid=8404, tid=8960
#
# JRE version: Java(TM) SE Runtime Environment (8.0_25-b18) (build 1.8.0_25-b18)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# V  [jvm.dll+0x5dd27]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions   of Windows
#
# An error report file with more information is saved as:
# D:\eclipse\workspace\Website\hs_err_pid8404.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

我在网上搜索了这个错误,但没有找到任何东西..

这是我使用的代码:

    try {
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
        String connectionUrl = "jdbc:sqlserver://localhost:1433;instance=SQLEXPRESS;databaseName=Mydatabase;integratedSecurity=true";
        con = DriverManager.getConnection(connectionUrl);
        System.out.println("Connected");
    } catch (ClassNotFoundException e) {
        throw new Exception("Driver Not Found");
    }

最佳答案

根据此网站Building the Connection URL您的连接字符串可能有问题。

jdbc:sqlserver://localhost:1433;instance=SQLEXPRESS;databaseName=Mydatabase;integratedSecurity=true

应该是:

jdbc:sqlserver://localhost;instanceName=SQLEXPRESS;databaseName=Mydatabase;integratedSecurity=true

(注意实例名称,而不是实例)

还有......

为了获得最佳连接性能,您应该在连接到命名实例时设置端口号。这将避免往返服务器以确定端口号。 如果同时使用端口号和实例名,则端口号优先,实例名将被忽略。

希望有帮助

关于java - Java 运行时环境检测到 fatal error - Microsoft SQL Server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27641775/

相关文章:

Java/JSP - 永久计数器

sql-server - 如何在不使用 VerifyExtraction 的情况下将 MSSQLServer 数据库提取为 .dacpac?

ios - Swift: "Fatal error: newElements.underestimatedCount was an overestimate"- 这个错误是什么意思?

ios - 如何修复致命异常 : NSInternalInconsistencyException

Java 从另一个类获取选定的组合框

java - 如何使用 EventHandler<MouseEvent> 在舞台上加载图像?

java - 使用java api从Word文档创建PDF文档

sql-server - 如何确定 SQL 事务日志文件的初始大小?

sql-server - 无法安装数据库图支持对象...没有有效的所有者

java - SubscribeActivity : Null Pointer Exception error 中的 Edittext 异常