Why can I connect to Clickhouse using DBeaver/JDBC but not HTTP? - http

I have no problem connecting to a Clickhouse database using DBeaver. My understanding is that DBeaver uses the JDBC driver to interact with databases. The connection details that I am using are similar to what's shown in the image below.
However, I need to use the HTTP interface to query this database so that I can query it programmatically. According to Clickhouse documentation the click-house server should be listening for HTTP on port 8123. When I try to connect to the Clickhouse database with the same connection parameters (with the exception of the connection url) using the curl request
curl --location --request GET 'http://host:8123/?user=username&password=password'
I receive the error
Code: 516, e.displayText() = DB::Exception: username: Authentication failed: password is incorrect or there is no user with such name (version 20.6.4.44 (official build))
I think my question ultimately boils down to what is JDBC doing under the hood? I assume it is using HTTP in some fashion since the JDBC URL uses port 8123. But how can I replicate the JDBC connection using a basic CURL request?
Relevant Clickhouse Documentation

Related

How to connect Amazon ElastiCache for Redis nodes enabled with in-transit encryption using redis-cli from windows server and/ from redis GUI client

I have a AWS elasticache(cluster mode disabled) with encryption at rest & encryption-in-transit enabled and trying to use redis-cli to connect from windows server (within same vpc).
Trying to connect to the RedisCluster from the server by following command
redis-cli -h - p 6379
I'm able to connect and see the endpoint
Master......awsamazon.com:6379>
But when I try to run redis commands the command prompt just hangs up infinitely without any output.
Help me solve this issue.
Note: I'm trying to connect from windows server.
When I use this command-
redis-cli -h master.****awsamazon.com.xx --tls - p 6379
It gives an error - "--tls" bad number of arguments
Thankyou in advance.
In case of redis with encryption-in-transit enabled, you need to connect using "stunnel". Please try installing stunnel and configure endpoints and ports according to this

Why is EF losing it's connection details on aws lambda startup

We have an API using entity framework, this is running in AWS lambda on the public.ecr.aws/lambda/dotnet:5.0 image. We are having an issue with it making a connection to a remote server on an internal network. If I test the setup on an EC2 windows server then it runs fine, but on the lambda function it is returning the following errors:
[Debug] Microsoft.EntityFrameworkCore.Database.Connection: Opening connection to database 'DatabaseXYZ' on server '10.0.10.30'.
[Debug] Microsoft.EntityFrameworkCore.Infrastructure: 'EFDbContext' disposed.
[Error] Microsoft.EntityFrameworkCore.Database.Connection: An error occurred using the connection to database '' on server ''.
We can't work out why we are getting this error. It is a very similar setup to our other dotnet apps running on lambda which use RDS databases, the only difference is that this DB is running on-prem via a VPN - as mentioned above the API works if we load it on a EC2 instance but we want to use this on Lambda - and need to understand why the issue is occurring.
The lambda is also setup in the vpc on private subnets.
As a test I ran this code as an image in Lambda and was able to connect and query just fine.

iAnywhere.Data.SQLAnywhere.SAException Connection error: Connection was dropped (may not be a SQL Anywhere server)

While trying to connect to SQLAnywhere (Sybase) database (C# code) from Azure ServiceFabric:
await using var connection = new SAConnection(connectionString);
await connection.OpenAsync();
receive iAnywhere.Data.SQLAnywhere.SAException
Connection error: Connection was dropped (may not be a SQL Anywhere server)
Error code is Error 832. This is generic connection error: An error occurred while attempting to establish a connection with the database server, but before attempting to connect to a database. Failure to initialize a communication link during the connection attempt is an example of this error. Creating a debug log file using the LogFile connection parameter may provide more information.
Locally it works, but does not work from Service Fabric.
Fix ideas tried:
Missing driver? Looks like no, Sybase (now SAP) SQLAnywhere requires special driver or client - but locally also works without this driver, just with iAnywhere.Data.SQLAnywhere.NETCore nupackage installed
Network connection/ firewall problems? Looks like no, database server can be pinged from Service Fabric node
It was another traffic protection tool. Although it was possible to telnet the port, still traffic from app was blocked by another tool.
Had a similar issue - turned out that whilst standard incoming traffic from the Sybase Server had been whitelisted in our Firewall, encrypted traffic from this had not been.
This meant I could ping and connect with Telnet, but got the same error when trying to log-in with my credentials
Connection error: Connection was dropped (may not be a SQL Anywhere server)
Our comms team solved the issue by whitelisted encrypted traffic from the server address as well. They also mentioned it possibly could have been solved we shared a valid security certificate for the encrypted data with their team, but were happy with the first course of action.

What connection protocol does JADE use for agent to agent connection over network?

Does anyone know that what kind of connection protocol does Java Agent Development (JADE) uses to provide over-network connection between agents for sending ACLMessages? (for example is it SSH connection or waht)
JADE has implemented an own small web server that uses HTTP, HTTPS or both for the MTP (Message Transport Protocol).
To specify the type, you can configure the MTP / MessagingService of JADE by start arguments from command line or via Profile from your own code. Details for command line arguments can be found in the 'JADE ADMINISTRATOR’S GUIDE'. Details for defining a Profile can be found in the source code and the JADE book.

AS/400 DDM service not running

I wanted to make a ODBC connection from Windows PC to AS/400 DB2 server and I wrote a VBA program. But I got the following error.
Remote port could not be resolved
Then, I checked the status of server with CWSPING and got the result below:
I - Verifying connection to system 192.168.1.2...
I - Successfully connected to server application: Central Client
I - Successfully connected to server application: Network File
I - Successfully connected to server application: Network Print
I - Successfully connected to server application: Data Access
I - Successfully connected to server application: Data Queues
I - Successfully connected to server application: Remote Command
I - Successfully connected to server application: Security
E - CWBCO1011 - Remote port could not be resolved
E - CWBCO1008 - Unable to connect to server application DDM, returned 8407
I - Successfully connected to server application: Telnet
W - CWBCO1015 - Connection verified to system 192.168.1.2, but there were warnings
This means DDM service is not working on the server. ODBC connection requires DRDA, which runs upon DDM service, so I think running DDM service is the key to make ODBC connection. So I tried STRTCPSVR *DDM command but got the result below
*DDM not valid for parameter SERVER
And also tried CHGDDMTCPA AUTOSTART(*YES) PWDRQD(*YES) command, but got an error and I got stuck.
Command CHGDDMTCPA in library *LIBL not found
Does anyone have an idea of enabling DDM server on AS400?
Server: IBM AS400
OS version: V4R1
Try STRHOSTSVR *DATABASE.
STRHOSTSVR is used to start servers associated with IBM i Access and i Access Client Solutions.
STRTCPSVR is used, in general, to start servers associated with TCP/IP like FTP, Telnet, etc. Except the HTTP Server which is started via the Web Administration site at http://<server>:2001.
Additionally to the answer from #jmarkmurphy:
You can easily check netstat *cnn for open ports.
There is actually a tcpsvr named *ddm but that isn't used with ODBC.
ODBC-Access only needs host server *database. There aren't any further requirements for host servers.
For checking which services are started at tcp startup time, use strfdu, option 5 with the file qusrsys/qatocstart. From there you can easily view and change what should be started and what not.
Finally, I got connected by using JDBC. The summary of what I found is as follows:
ODBC seems using DRDA(port 446) but the server does not have DRDA/DDM service
OLEDB seems connecting Data Access(port 8471) but issued unknown error
JDBC also connection Data Access(port 8471) and it worked!
The first error I encountered when using ODBC is "Remote port could not be resolved". What happened behind this seems as follows:
ODBC asked Server Mapper(port 449) to find DRDA port(it may change on a server)
Server Mapper could not find DRDA port because the server has no DRDA service
ODBC showed "port not resolved" error
Then, I tried OLEDB this time. It checked user/password correctly but issued unknown error. When I put incorrect password, it showed "password is incorrect", which means OLEDB successfully log on to the server but got some error after sign on.
The last, I used JDBC and successfully connected! Generally, the connection url is like "jdbc:as400://" but it showed error. Using trace of JDBC, it seems to have problem on sign on to the server. So I changed the url to "jdbc:as400://:8471", then I finally connected. Looking into trace, it directly access to port 8741 and send user/password and get connected. I don't know the detail, but it worked!
Appreciated for your help!

Resources