How can we connect to snowflake using DB Visualizer using Azure AD - snowflake-cloud-data-platform

I am using the following Database URL in DB Visualizer to connect to snowflake using Azure AD authentication
jdbc:snowflake://accountname.snowflakecomputing.com/?authenticator=externalbrowser&warehouse=xxxxx_WH&db=xxx_db&schema=xxxx_schema
I am getting the following error : JDBC driver encountered communication error. Message: Exception encountered for HTTP request: sun.security.validator.ValidatorException: No trusted certificate found.

This error is usually indicating that the jvm can't find the necessary certificates. You can refer to the following link for further troubleshooting:
https://community.snowflake.com/s/question/0D50Z00009LHQMSSA5/how-do-i-resolve-no-trusted-certificate-found-error-when-connecting-to-snowflake-via-jdbc-driver-in-java
See if you can export JAVA_HOME to match the jdk installation where your cacerts is located. It is usually located under <JAVA_HOME>/lib/security/cacerts.
-pd

Related

DataGrip connecting to Snowflake getting No Trusted Certificate error

Trying to connect to Snowflake using DataGrip and keep getting "No trusted certificate found." error. I've tried downloading the certificate from Chrome and installing it via DataGrip settings section but did not work. I am however able to access my Snowflake account using dbeaver (same jdbc driver). Any ideas?
and here is the error I get.

Microsoft SQL server as Atrifactory 7.38.10 metadata database

We have installed Atrifactory 7.38.10 on a windows server, Microsoft SQL server configured in System.yml as a database for metadata.
String connectionUrl =
"jdbc:sqlserver://localhost:1433;" +
"databaseName=AdventureWorks;integratedSecurity=true;" +
"encrypt=true;trustServerCertificate=true";
Artifactory.bat start throwing below mentioned error.
Could not initialize database (db config: {mssql jdbc:sqlserver://dev.tfs2017sql.xyz.com:55300;databaseName=JFROGPOC;encrypt=false;sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository;integratedSecurity=true;}): TLS Handshake failed: x509: certificate signed by unknown authority
error connecting to database. giving up
jfrog.com/metadata/v7/services/common/db.(*databaseBearer).init
jfrog.com/metadata/v7#v7.37.0/services/common/db/database_bearer.go:152
Java version is 11 and JDBC driver is “mssql-jdbc_auth-10.2.1.x64.dll” for windows integrated authentication
From the way it looks, the issue is on the metadata service as you said.
I suggest trying to follow this article I wrote in the past about it and try to provide to the metadata service an additional golang connection URL(as it's possible that the script conversion from the Java doesn't support all the parameters), and make sure you have added the certificate to the /etc/ssl/certs folder as metadata service is written in Golang and usually load the certificates from the OS and not from the Java trust store.

SQL Server log in failing from Java DriverManager.getConnection(), working from Python with pymssql.connect()

I'm trying to use DriverManager.getConnection() to connect to a SQL Server db from a Java application, but I keep getting "Login failed for user" errors with it. I've tried using both com.microsoft.sqlserver.jdbc.SQLServerDriver and net.sourceforge.jtds.jdbc.Driver to connect, but both keep hitting the issue.
Here's the code I'm using to connect:
Class.forName("net.sourceforge.jtds.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:jtds:sqlserver://SERVERADDRESS:1433;DatabaseName=DBNAME;user=USER;password=PASS");
I know that account has access to that DB, as I've connected to it before from a Python application using pymssql.connect(SERVERADDRESS, USER, PASS, DBNAME) with the same server/DB/creds.
From this article, I eventually managed to get it working using windows authentication with my personal account, but I still can't get it to work using our service account. Does anyone have any insight into why the Python app can connect but the Java one can't?
pymssql is built on top of FreeTDS. Both FreeTDS and jTDS support an older Windows authentication scheme named NTLM, while current versions of Microsoft's JDBC Driver for SQL Server (mssql-jdbc) no longer support that authentication mechanism.
So, given that you've confirmed that pymssql can connect, you should be able to connect from your Java app as Windows user MYDOMAIN\username using jTDS like so:
String myUid = "username", myPwd = "mypassword";
String connUrl = "jdbc:jtds:sqlserver://192.168.1.123:1433/databasename;DOMAIN=MYDOMAIN";
Connection conn = DriverManager.getConnection(connUrl, myUid, myPwd);
To find out the reason of "Login failed for user" one should go to SQL Server error log.
The next row to 18456 error will give you the reason.
The most probably reason of failure in your case is that the server is configurated to use Windows Authentication only

JDBC URL connection to SQL Server using Windows Authentication in JIRA plugin

I am currently at my wits end. I am trying to connect a JIRA plugin (Atlassian Java SDK) to a SQL Server 2012 database. It's required that I use Windows Authentication, but JIRA is logging:
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.
I've read that this can be combatted by adding the sqljdbc_auth.dll file to the program's library path, but there are no references specifically for JIRA plugins on how to do this other than for the base JIRA dbconfig.xml, which I am not using. This is a connection made within the plugin using the code:
String url = String.format("jdbc:sqlserver://%s:1433;databaseName=%s;integratedSecurity=true;domain=XXXX;", server, database);
I have tried to add the dll file to the following locations, all to no avail:
C:/{JIRA INSTALL PATH}/bin
C:/{JIRA INSTALL PATH}/jre/bin
C:/{JAVA INSTALL PATH}/jre_8.x.x/bin
What gives?
UPDATE:
I have gone in and added the JDBC JAR/DLL to the classpath/library path respectively in the JIRA Windows service configuration tool. Still getting the same error.
UPDATE 2:
I have switched to using the JTDS driver to see if JIRA was just not able to use the standard JDBC driver for some reason, but getting a similar error:
java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.
I have also created a new Java app to test this in a controlled environment, but do not get this error after adding the ntlmauth.dll file to the C:\Windows\System32 directory. This leads me to believe this may be a bug within JIRA or I have something configured improperly.
Here is my own conclusion after many weeks of searching:
It is (currently) impossible to do this without the use of a password (which is sometimes the entire point of using Windows/Active Directory credentials). You can however use the JTDS driver in junction with a domain, username, and password to authenticate to servers that require windows authentication. This does not solve the core issue, but from what I can tell is the only current solution close enough to it.

How to connect to sql DB from soapUI using connection string?

I would like to ask someone who already tried to connect to SQL database from soapUI opensource version.
I have a test step JDBC request where I try to test and connect to my sql database. I use opensource version of soapUI. I read how it should be set up but still experience some problems.
This is what I do:
I installed java 8 and jdbc driver version 4.1. Added jdbc jar file to SoapUi/jre/bin folder as it is said in documentation for soapUI. This version of driver should work with Java 8.
Then in Driver field I write
com.microsoft.sqlserver.jdbc.SQLServerDriver
In connection string:
jdbc:sqlserver://Sservername:portnumber;databaseName=Consumption;username=alyona.kovalyova;password=mypassword
I get error saying
Can't get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'alyona.kovalyova'. ClientConnectionId...
I use my domain account because in our company the policy does not allow us to use database user. Because of this I tried to add integratedSecurity parameter to the string which should allow to login with windows account like this:
jdbc:sqlserver://S23-AS:1433;databaseName=Consumption;integratedSecurity=true
I also get error:
Can't get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId..
Does anyone encountered the same issue before? Could you give some recommendation?
For integrated authentication to work you'll need sqljdbc_auth.dll matching your environment (32bit / 64bit) in your library path (putting it in bin as well might help already)

Resources