How do I connect to Connect to Db2 with JDBC and SSL and avoid the error "A DRDA Data Stream Syntax Error was detected. Reason: 0x3. ERRORCODE=-4499"? - db2

I'm trying to connect to Db2 but I get the following error message
[jcc][t4][2034][11148][4.25.23] Execution failed due to a distribution protocol error that caused deallocation of the conversation.
A DRDA Data Stream Syntax Error was detected. Reason: 0x3. ERRORCODE=-4499, SQLSTATE=58009
What does that mean, and how do I get connected?

Well the short answer is that you might just need to add the sslConnection=true JDBC parameter
I.e. your JDBC URL needs to look something like this
db2://db2whoc-abcdefg.services.eu-de.bluemix.net:50001/BLUDB:sslConnection=true;
Depending on what tool you are using, you might edit the URL directly, or add as an extra JDBC property
Now the above only works if you are using a reasonably recent JDBC driver.
The DigiCertGlobalRootCA.crt used by e.g. Db2 on Cloud, Db2 Warehouse and Db2 Warehouse on Cloud was not bundled in older drivers. You can cross-reference the driver version (e.g. 4.25.23 in the question) against the drivers listed here. DB2 JDBC Driver Versions and Downloads and upgrade if not on the latest release
If your Db2 server is using a different certificate (for example a self-signed certificate) then you would need to download the certificate, and set the JDBC property sslCertLocation to point to it's location, or you can import the certificate into a local store, and use sslTrustStoreLocation and sslTrustStorePassword and a import the cert into their local certificate store.
All these JDBC properties are described on the
Common IBM Data Server Driver for JDBC and SQLJ properties for all supported database products page

Related

Is There a Way to Get Spring Cloud Dataflow Server and Skipper Working with GCP Cloud SQL (MySQL or Postgresql)

I'm currently using helm charts from bitnami (Here) and trying to use a Cloud SQL instance in GCP. No matter what connection string I build, I get various connection errors connecting to the database. This causes the initial pod startup to fail, and never fully initialize.
It does not appear that spring-cloud-dataflow comes bundled with spring-cloud-gcp so it cannot be configured via Instance Name, so I assume we need to use the Private IP address, which fails every time.
For the below tests, a Cloud SQL MySQL instance was created, and a Cloud SQL Postgresql instance was created.
Chart configuration 1 for MySQL instance: (username and password omitted for brevity)
mariadb.enabled=false
externalDatabase.dataflow.url=jdbc:mysql://<privateip>/dataflow?useSSL=false
externalDatabase.dataflow.username=root
externalDatabase.driver=org.mariadb.jdbc.Driver
Results in (using port 0 or port 3306):
java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=<private IP>)(port=0)(type=master) : Could not connect to <private IP>:0 : unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
Caused by: java.io.EOFException: unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
Chart configuration 2 (postgresql instance):
mariadb.enabled=false
externalDatabase.dataflow.url=jdbc:postgresql://<Private IP>:5432/
externalDatabase.dataflow.username=postgres
externalDatabase.driver=org.postgresql.Driver
Results in:
org.postgresql.util.PSQLException: The connection attempt failed.
Caused by: java.net.SocketException: Connection reset
I've verified that I can reach the databases via jdbc through Squirrel SQL (for postgresql) and MySQL workbench.
Will this never work unless spring-cloud-dataflow ships with spring-cloud-gcp?
You'll need to use the Cloud SQL Proxy or the Cloud SQL Java Connector.
There are a couple of answers here that show how to do that:
Connecting to Cloud SQL from Dataflow Job
Is it safe to connect DataFlow job to Cloud MySQL with proxy (by os.system)
Also, if your Cloud SQL instance is private IP only, you'll need to make sure your Data Flow deployment is in the same VPC as your Cloud SQL instance. For Public IP instances, using the Java connector or the proxy alone should be fine.

Connection failure Postgresql on AWS-RDS Instance in a private network from PowerBI Desktop & Service

I have an AWS RDS (PostgreSQL) that is inside a private network - only accessible via a VPN and Bastian Host.
I am able to establish connection from PBI Desktop to "PostgreSQL-RDS Instance." By creating SSH tunneling from my Laptop (localhost) to Bastian Host using ODBC Driver. With this approach all the data is imported onto PBI desktop(import mode).
But our requirement is to establish connection through a direct query to refresh data real time and generate the Reports Dynamically which I am not able to.
I entered the database credentials into the Power BI desktop tool, and it not working correctly in the power bi desktop, getting a Timeout Error.
I must use direct query, I can't use import.
Any help is appreciated.
An exact error that you are getting would help get to the root cause of the issue. However, a few basic troubleshooting steps that I'd suggest are:
Ensure that you have a compatible version of the software installed on your machine such as the Npgsql-4.0.9. AT times the latest version of the software usually causes issues.
Ensure that you remove the semicolon at the end of the query.
Once you get the query running successfully on the desktop version, when you publish it to the web version, the visuals will not be able to connect to the database unless an on-premises data gateway is setup. To do so, more details on setting up a data gateway to automatically refresh the dataset for the power bi web version are here:
Refresh AWS RDS database from Power BI Web you are successfully able to query directly

ZSS initial setup failing with invalid connection string

I am trying to get the Zumero for SQL Server working and I cannot get past running the test client. I get the below error
Connection string in web.config is
<settings temp_directory="C:\ProgramData\Zumero\ZSS Server\temp\"
odbc_connection_string="DSN=krishna;User Id=syncadmin;Password=syncadmin;"
license_key="<removed>" />
The description for Event ID 1 from source Zumero cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
Error -1 (mssql): {"diag":[{"SQL_DIAG_MESSAGE_TEXT":"[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database \"ZumeroTest\" requested by the login. The login failed.","SQL_DIAG_NATIVE":4060,"SQL_DIAG_SQLSTATE":"42000"},{"SQL_DIAG_MESSAGE_TEXT":"[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed","SQL_DIAG_NATIVE":0,"SQL_DIAG_SQLSTATE":"IM006"},{"SQL_DIAG_MESSAGE_TEXT":"[Microsoft][ODBC SQL Server Driver]Invalid connection string attribute","SQL_DIAG_NATIVE":0,"SQL_DIAG_SQLSTATE":"01S00"}],"SQLRETURN":-1}
..\..\..\src\core\sg\sg_mssql.c:344
..\..\..\src\core\sg\sg_mssql.c:384
..\..\..\src\core\server\zum_db_mssql.c:2896
..\..\..\src\core\server\zum_respond.c:4454
..\..\..\src\servers\iis\main.cpp:1211
The publisher has been disabled and its resource is not avaiable. This usually occurs when the publisher is in the process of being uninstalled or upgraded
Either the SQL Server user doesn't have rights or the database doesn't exist.
You can use a DSN, but for troubleshooting purposes I recommend putting the connection details directly in the connection string for now. Once it's working you can migrate the settings back to a DSN if you like.
Looks like you're using SQL Server authentication. So the odbc_connection_string value should look like this:
Driver={SQL Server Native Client 11.0};Database={database};Server={server.ad.domain.com};UID={sql_server_user};PWD={password};
The database must exist and the user specified must have appropriate read/write access to it.
(If you're setting minimum necessary permissions, you'll also want to make sure the user has VIEW SERVER STATE rights, as described here.)
While unrelated to your invalid connection string problem, the messages about The description for Event ID 1 [...] and The publisher has been disabled [...] indicate that ZSS hasn't been correctly registered with the Windows Event Viewer. Did you install the server by hand (from the .zip file) or using the installer?
You can fix those messages using the following command (which probably requires an admin prompt):
wevtutil im "PATH\TO\events.man" /rf:"PATH\TO\zumero_server.dll" /mf:"PATH\TO\zumero_server.dll"
where PATH\TO is the path where you extracted those files from the .zip. If you used the installer then they should be located at: %PROGRAMFILES%\Zumero\ZSS Server
If you installed manually from the .zip then it's worth noting that the instructions had a subtle typo in that command which would cause it to fail. That typo has been fixed in the past few days, but it may have caught you during your installation and caused this issue.

ODBC/JDBC proxy to Postgresql

I've heard of a tool allowing to expose an ODBC/JDBC compliant database as a Postgesql database.
It was an opensource project on GitHub or Sourceforge. I'm unable to remember it or find it in my bookmarks.
Any clue ?
I'm assuming you need this because you have a pglib based legacy application.
In that case a work around might be to set up a gateway postgresql database, and then use the foreign server capability to connect via ODBC to the real target database.
You application would then talk to the gateway database via pglib, which would then in turn delegate the query down to the real database.
ODBC foreign data wrapper
Postgresql 9.1 documentation on creating a foreign server

Using Entity Framework with Informix

I've been trying for quite some time to use Entity Framework with our IBM Informix databases. Hours of searching has pointed me towards installing the IBM .NET Data Server Provider, which I have installed, however when I attempt to add a new Entity Model to my project I only have the Microsoft SQL Server Data Providers listed. Am I missing a step? Is this even possible?
I am not an expert on Windows or .NET; treat any comments I make with due caution.
Installing the .NET Data Server Provider is an important first step. You now have to make sure that you can use it to connect to the Informix databases you want to manipulate. There are several things you'll need to check here:
Is the server (meaning the Informix instance) configured to allow DRDA connections?
By default, it probably isn't.
If you're the DBSA (database system administrator), you'll need to check that you've enabled 'drsoctcp' connections on the system, and configured a server alias to use that connection.
If you're not the DBSA, you'll need to chat with your DBSA to get the relevant information.
Assuming that you have DRDA connectivity enabled at the server side, you then need to ensure you have an appropriately configured ... DSN? Your client code needs to be able to connect to the server.
There is no reason I'm aware of why it cannot be done. However, I don't know exactly how to guide you step-by-step through any of the above.
You might need to seek assistance from IBM Technical Support.
You would help everyone if you clarified which version of Informix (the DBMS) you have, along with the version information for the platform where it is running (whether Windows or Unix, and the o/s version information) - and which version of the Data Server Provider you are using (and which variant of Windows you are using it on).