I'm trying to connect to a MS SQL Server DB using JDBC and on this line:
String connectionUrl = "jdbc:" + url + ";user=dummy;password=dummy;";
conn = DriverManager.getConnection(connectionUrl);
I'm getting this massive wall-of-text of an error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at javax.crypto.JceSecurityManager.<clinit>(JceSecurityManager.java:65)
at javax.crypto.Cipher.getConfiguredPermission(Cipher.java:2543)
at javax.crypto.Cipher.getMaxAllowedKeyLength(Cipher.java:2567)
at sun.security.ssl.CipherSuite$BulkCipher.isAvailable(CipherSuite.java:548)
at sun.security.ssl.CipherSuite$BulkCipher.isAvailable(CipherSuite.java:527)
at sun.security.ssl.CipherSuite.isAvailable(CipherSuite.java:194)
at sun.security.ssl.SSLContextImpl.getApplicableCipherSuiteList(SSLContextImpl.java:350)
at sun.security.ssl.SSLContextImpl.getDefaultCipherSuiteList(SSLContextImpl.java:308)
at sun.security.ssl.SSLSocketImpl.init(SSLSocketImpl.java:607)
at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:549)
at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:110)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1606)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1323)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at BusinessManager.Session.<init>(Session.java:33)
at BusinessManager.BusinessManager.getSession(BusinessManager.java:172)
at example.Example.ConfigureEnvironment(Example.java:198)
at example.Example.main(Example.java:50)
Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
at javax.crypto.JceSecurity.<clinit>(JceSecurity.java:89)
... 22 more
Caused by: java.lang.SecurityException: Cannot locate policy or framework files!
at javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:254)
at javax.crypto.JceSecurity.access$000(JceSecurity.java:48)
at javax.crypto.JceSecurity$1.run(JceSecurity.java:81)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JceSecurity.<clinit>(JceSecurity.java:78)
... 22 more
I've followed a couple of links, made sure both server and client are using the same JDK (1.8.0_20). I've also downloaded the "JCE Unlimited Strength Jurisdiction Policy Files" and placed them in the JDK. I've also followed this link but I'm not sure whether I should be meddling with the JDK's "java.policy" files...