Problem Accessing HyperSQL from C# with JDBC

205 Views Asked by At

I'm trying to access a local HyperSQL database from a .net core 2 web application.

I have followed the instructions in the link below page to create a connector HSQLDB driver dll and referenced this in my project with no build issues and project builds and runs. http://nikolaiklimov.de/query-java-HyperSQL-database-with-csharp/

my code throws an exception when i try to connect to the database (which i have confirmed is running on my machine) on the second line 'gettimezone'.

java.sql.DriverManager.registerDriver(new org.hsqldb.jdbcDriver());
            java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("Europe/Moscow"));
            using (java.sql.Connection conn = java.sql.DriverManager.getConnection(HyperSQL))
            {

            }

The exception thrown is method not found in sun.util.calender.zoneinfofile

The type initializer for 'sun.util.calendar.ZoneInfoFile' threw an exception.

Method not found: 'Void System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.Security.AccessControl.FileSystemRights, System.IO.FileShare, Int32, System.IO.FileOptions)'.

at Java_java_io_FileDescriptor.open(String name, FileMode fileMode, FileAccess fileAccess)
at java.io.FileDescriptor.open(String , Int32 , Int32 )
at java.io.FileDescriptor.openReadOnly(String )
at java.io.FileInputStream.open(String )
at java.io.FileInputStream..ctor(File file)
at sun.util.calendar.ZoneInfoFile.1.run()
at java.security.AccessController.doPrivileged(Object , AccessControlContext , CallerID )
at java.security.AccessController.doPrivileged(PrivilegedAction action, CallerID )
at sun.util.calendar.ZoneInfoFile..cctor()

0

There are 0 best solutions below