Azure Cosmos DB Emulator : Unable to connect to MongoDb via MongoChef - mongodb

After following the instructions from the following official reference "Use the Azure Cosmos DB Emulator for local development and testing", we attempted to connect to MongoDb using MongoChef using the connection string pasted below:
mongodb://localhost:C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==#localhost:10255/admin?ssl=true
But when we test the connection through MongoChef we get the error pasted below:
Connection failed.
SERVER [localhost:10255] (Type: UNKNOWN)
|_/ Connection error (MongoSocketOpenException): Exception opening socket
|____/ Socket error: Connection refused: connect
Details:
Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27018, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
If we check the ports currently in use on our system, we do not see 10255 being used at all.
Could someone please help us understand what's wrong here.

The connection string is correct. Studio 3T has a very nasty bug - when you use From URI function while creating new connection it cuts the "+" characters that are present in the key, that's why you need to copy the key manually to the corresponding field in connection properties.
Also, make sure the Emulator is actually launched (tray area icon should be present).

Related

Liquibase-Github actions (Connection timed out error while running liquibase in github actions and while doing diff generation)

When I'm trying to run Liquibase in Github actions workflows getting the below error
Unexpected error running Liquibase: Connection could not be created to jdbc:mariadb://10.13.10.2:3306/liquibase_test with driver org.mariadb.jdbc.Driver. Socket fail to connect to host:address=(host=10.13.10.2)(port=3306)(type=primary). Connect timed out
not only in github actions when I'm trying to do diff generation in server where liquibase is installed getting the same error.
Unexpected error running Liquibase: Connection could not be created to jdbc:mariadb://10.13.10.2:3306/liquibase_test with driver org.mariadb.jdbc.Driver. Socket fail to connect to host:address=(host=10.13.10.2)(port=3306)(type=primary). Connect timed out
Can anyone please help me?

Creating a local connection in Oracle SQL developer 12c

Not sure if I'm missing anything.
I'm trying to create a local connection in order to create a new user in Oracle SQL developer 12c. (AVOIDING CDB connection)
After browsing for an hour, came across 2 methods.
Using connection type as "Local/Bequeath"
Throws following error (Status : Failure -Test failed: ORA-01017: invalid username/password; logon denied)
Using connection type as "Basic", Hostname as "localhost", Port as "1521", and Service name as "XEPDB1"
Throws following error (Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor)
Thanks.

I cant connect to MongoDB Atlas

I tried to connect with
*mongo "mongodb+srv://cluster0.mi3o1.mongodb.net/test" --username cristian* in the shell.
But instead, it looks like it's trying to connect with:
*mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb*
I am getting the error
*Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: No connection could be made because the target machine actively refused it. :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
bash: mongodb+srv://cluster0.mi3o1.mongodb.net/test: No such file or directory*
I have created the cluster, database access with admin role user cristian, whitelisted both my IP and all IPs 0.0.0.0/0, created a new database, loaded sample databases, opened ports 27015,27016,27017 and tested on portquiz.net.
I added a PRTSCN.
Please help!
terminal prtscn
Thank you very much D. SM for your help, it looks like it was a problem with my .bash_profile. When i did the copy and paste for the 2 paths i dont know why the terminal writed the last " on another row and got some spaces between. I rewrited the 2 rows with no space like this:
alias mongod="/c/Program\ files/MongoDB/Server/4.4/bin/mongod.exe"
alias mongo="/c/Program\ Files/MongoDB/Server/4.4/bin/mongo.exe"
and it worked.

Unable to connect to MongoDB Atlas using Vert.x MongoClient

I'm trying to connect to a MongoDB database hosted in MongoDB Atlas using Vert.x MongoClient:
I'm creating MongoClient with this code (Kotlin):
MongoClient.create(vertx, jsonObjectOf(
"connection_string" to "mongodb+srv://<username>:<password>#<cluster_address>/my_db"
))
(with real values, obviously)
But I'm unable to perform any operation agains database. I get a connection timeout error:
com.mongodb.MongoTimeoutException: Timed out after 30000 ms while
waiting for a server that matches
ReadPreferenceServerSelector{readPreference=primary}. Client view of
cluster state is {type=REPLICA_SET,
servers=[{address=<server1_address>, type=UNKNOWN, state=CONNECTING},
{address=<server2_address>, type=UNKNOWN, state=CONNECTING},
{address=<server3_address>, type=UNKNOWN, state=CONNECTING}]
If I try to connect using mongosh (CLI tool) and MongoDB Compass using the same connection string, it works fine.
I have tried confguring the client with parameters (hosts, ports, etc...) instead of using a connection string and I get this error when I make a query:
MongoSocketReadException: Prematurely reached end of stream
After 11 days struggling with this, I have just solved it.
I have included "trustAll" : true option when creating MongoClient and it's working now. It's not the best solution, but anyway...

quickstart error - Using EF Migrations for local SQL Server and keep loosing db connection

I am following IdentityServer4 quickstart and trying to migrate in memory data to my local SQL Server (not SQL express or LocalDB that came with VS). My connection string is:
#"Server=localhost,1434;Database=MyIDS;user id=tester_1;Password=tester_1;trusted_connection=yes;".
When I start my IdentityServer, it creates the enpty db, MyIDS, and then throw an exception with 2 inner exceptions:
Inner Exception 1:
SqlException: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - An established connection was aborted by the software in your host machine.)
Inner Exception 2:
Win32Exception: An established connection was aborted by the software in your host machine.
Can anyone tell me what's going on here? Why a working connection always gets dropped?
localhost,1434 looks wrong, you don't need to provide the port 1434 and the commma should not be used either, it should be a colon in that case.
I typically use for local development:
server=.;Database=ASPIdentity;Trusted_Connection=True;
dot means localhost, if you use sqlexpress the connetion string would become
server=.\\sqlexpress;Database=ASPIdentity;Trusted_Connection=True;