Snowflake .net connector certificate error - snowflake-cloud-data-platform

I am having trouble using .net connector (https://github.com/snowflakedb/snowflake-connector-net). It works from browser/Tableau/Excel. For tableau/excel I have to pass CaBundleFile.
Is there a way to pass a certificate file (CaBundleFile) using the .net connector?
I am getting following error.
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: Could not
establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

Unlike the ODBC driver, Snowflake doesn’t perform OCSP checking for .NET driver which uses the underlying .NET framework for checking validity of the HTTPS certificate.
One thing that might help is looking through similar GitHub issues for ideas (they discuss upgrading and network traces):
https://github.com/snowflakedb/snowflake-connector-net/issues/6
You might also try looking at some of the Microsoft docs and forums for the error on some troubleshooting ideas:
https://learn.microsoft.com/en-us/archive/blogs/jpsanders/troubleshooting-asp-net-the-remote-certificate-is-invalid-according-to-the-validation-procedure

Related

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.

AWS RDS Instance is not connecting to Jmeter

I am trying to connect my RDS instance to a Jmeter load test however no matter what I try, I keep getting this error message in the Results Tree:
Cannot create PoolableConnectionFactory (The connection to the host database-1.cqdkrfikhe1t.us-east-1.rds.amazonaws.com, named instance database-1 failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.)
I feel it may be a problem with my Database URL in JDBC Connection Configuration.
The picture below shows the summary report.
I have mainly tried rewriting the Database URL multiple different ways but none of them seem to work. I have also tried removing and reinstalling the JDBC Drivers but that doesn't seem to work either. I have absolutely no idea what the problem could be. Could someone please help me out with this problem?
Edit: When I change the Database URL I sometimes get this error
message as well:
Cannot create PoolableConnectionFactory (The driver could not establish a secure connection to SQL Server by using Secure Sockets
Layer (SSL) encryption. Error: "PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target".
ClientConnectionId:9b700d73-f3f0-4cf6-b3a4-607fa9827219)
I think you need to use port 1433
Check out Connecting to a DB instance running the Microsoft SQL Server database engine article
So cross check the port number, VPC options, public accessibility, etc. with the values from the JDBC Connection Configuration
More information: The Real Secret to Building a Database Test Plan With JMeter

How can we connect to snowflake using DB Visualizer using Azure AD

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

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 Write data to Sql Table from SharePoint WebPart when DB and SP are on different machine?

I am working on SharePoint 2013. Database is on SqlServer 2008R2. Both SP and DB are on different machines. I am creating a webPart which is associated with usercontrol. I'm writing the logic in cs file of usercontrol, to write data collected from the form into Data table of sql server.
Connection string: Server=myServerAddress;Database=myDataBase;User
Id=myUsername; Password=myPassword;
But it is failing and throwing an error like "Login failed for user".
Please guide.
You may be running into the Double Hop Problem (also see why NTLM fails). To know for sure use ULSViewer to drill into the SharePoint Error details. From the SQL side check the default trace. "default trace gives you the reason for login failure in plain English"
If it is the double hop causing the error, you may want to look into configuring Kerberos or switching to using an External List instead of a web part and using the Secure Store Service with BCS.

Resources