0

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.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Vladimir Zaguzin
  • 191
  • 5
  • 22
  • This thread might have some help https://stackoverflow.com/questions/140030/possible-causes-of-java-vm-exception-access-violation – noobCoder May 03 '19 at 19:24
  • @noobCoder honestly, not really – Vladimir Zaguzin May 03 '19 at 19:46
  • You may want to upgrade, Java 10 is end of life and no longer supported, and it is entirely possible this was a bug that has been fixed in a more recent version of Java 11 or 12. And if you really need to stay on Java 10, then try upgrading to 10.0.2. – Mark Rotteveel May 04 '19 at 05:41

0 Answers0