I'm trying to connect to a Microsoft SQL Server database with a class that looks like this

import java.sql.*;

public class ssh_test_db
{
    public void dbConnect(String db_connect_string)
    {
        try {
            Connection conn = DriverManager.getConnection(db_connect_string);
            System.out.println("connected");
            Statement statement = conn.createStatement();
            String queryString = "select * from sysobjects where type='u'";
            ResultSet rs = statement.executeQuery(queryString);
            while (rs.next()) {
                System.out.println(rs.getString(1));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args)
    {
        ssh_test_db connServer = new ssh_test_db();
        connServer.dbConnect("jdbc:sqlserver://server:port;database=test;integratedSecurity=true");
    }
}

I keep getting errors like this:

Connected to the target VM, address: '127.0.0.1:54506', transport: 'socket'

A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000513498f7, pid=23488, tid=22732

JRE version: Java(TM) SE Runtime Environment (10.0.1+10) (build 10.0.1+10) Java VM: Java HotSpot(TM) 64-Bit Server VM (10.0.1+10, mixed mode, tiered, compressed oops, g1 gc, windows-amd64) Problematic frame: V [jvm.dll+0x3b98f7]

No core dump will be written. Minidumps are not enabled by default on client versions of Windows

I don't know what to look for as a cause for this error.

0 Answers