ErrorMessage while open connection to Denodo via npgsql in c# - c#

sorry, if this is question is (to) easy for stackoverflow community.
I am trying to connect to Denodo (Version 7), via c# code.
I installed npqsql and created a connection string with: {host} {port} {username} {passwd} {database} and the SSL-Mode as required.
(user and pwd combination was checked via Launch Pad)
For trying I use a simple select statement.
If I call Open() on my NpqsqlConnection object I get the error message {"Received unexpected backend message ParseComplete. Please file a bug."}
For beeing sure I tried to ping the host, which works fine. And if I try without SSl, the error message indicates that the SSl is required, therefor I think the correct backend is found.
Could someone give me a hint?
Thanks
Jessi
I checked the Denodo Community, and the given examples: https://community.denodo.com/docs/html/browse/6.0/vdp/developer/access_through_an_ado.net_data_provider/access_through_an_ado.net_data_provider
https://community.denodo.com/answers/question/details?questionId=90670000000XcbkAAC&title=How+to+execute+C%23+program+using+vdp-clients-ADO.NET

Related

C# MySql error: MySql.Data.MySqlClient.MySqlException [duplicate]

Trying to connect to MySQL on my web host, using Connector/Net C#/WinForms in Visual Studio 2012 Update 3, but getting the below error message:
Authentication to host '1.1.1.1' for user 'username#mydomain.com' using method 'mysql_native_password' failed with message: Access denied for user 'username#mydomain.com'#'2.2.2.2' (using password: YES)
string connectionString = "SERVER=1.1.1.1;PORT=3306;DATABASE=databaseName;UID=username#mydomain.com;PASSWORD=mypassword;";
MySqlConnection connection = new MySqlConnection(connectionString);
connection.Open();
I am connecting remotely, have whitelisted my IP (and even temporary whitelisted all (%) to test), triple checked the username and password and IP.
I originally tried the username without the domain ( username rather than username#mydomain.com) but it gave me the below error:
Authentication with old password no longer supported, use 4.1 style passwords.
Any assistance would be much appreciated, thanks!
Its problem of 'Remote Database Access Hosts'.
"You can allow external web servers to access your MySQL databases by adding their domain name to the list of hosts that are able to access databases on your web site."
MySql access is not granted to IP address of the system at which application is running.(in your case its '2.2.2.2' ).
Note:- '2.2.2.2' is your public IP address.
Two possible things:
MySQL is case sensitive make sure that the case of Database= in your connection string matches with the actual database name
You may have to grant privileges to the user.
I hope this help you.
Check your application settings file (or wherever you have stored the connection string).
In my case the application was using the old connection string (which was not valid). I was assuming that the change I made in the code of the settings file is reflected to the designer (of the settings file). But it was not!
After creating a new user in MySQL, in MySQL Workbench "Test Connection" will succeed but the C# MySqlConnection.Open() will throw the same exception and message as the question (tested with localhost and 127.0.0.1 and the local ip address).
The reason is that MySqlConnection.Open() will somehow use SELECT privilege, and you need to at least enable the SELECT privilege for the new user. The error message is misleading.
This might be related to the case of specific Membership SQL Server based instructions on ASP.NET 4.5, workaround is to create new membership in web.config, drop mvc 4 AccountControler and use old from MVC3 more here or in the internet:
http://www.nsilverbullet.net/2012/11/06/using-mysql5-as-membership-backend-for-aspnet45-mvc4-application/
In my case updated password was not used. I just generated the password using Password Generator and copy it but forgot to click Change Password.
Also check the user is added to the database and has Privileges.
For me, using the actual IP address instead of the domain name solved the problem
While Whitelisting my Ip on cpanel i had accidentally put a space in there after my ip address.[Should have been handled by them]
I added the ip again and it worked.
In my case, the problem was misleading as well.
Had quite a few windows terminals running "the same" .net app all connecting to a remote MySQL server (installed in a windows server machine). However, only one always popping the specific error when anyone clicked to run the .net application. ODBC test connection passed successfully, and no matter if the error popped, when presing OK the application continued loading successfully finally and then worked fine.But again afterwards , when anyone tried to run in for the first time the message appeared. and I repeat only in this specific terminal! The fix finally came when I noticed, that it was only in this specific terminal with the problem that we had forgotten DHCP enabled! and "although it was given always the same IP" from our IT policies, however it only worked when we disabled DHCP and set this IP, SUBNET and GW, as fixed !
Check with a program like Navicat that the mysql server user has a native password. Everything is correct but if you are getting this error check the version of the link DLL
This error; Mysql.Data.dll and Mysql Server version mismatch error. Download and install an older version
https://downloads.mysql.com/archives/c-net/
Mysql Version < 4.5
Mysql.Data.Dll version= 6.0.3

MongoClient ignores the connection string

I just started to use MongoDB(4.4) and its C# driver. I set up my MongoDB with the default option, localhost:27017. Then I turned on the authorization, created a superuser with root permission, like this:
db.createUser(
{
user: "superuser",
pwd: "123",
roles: [ "root" ]
}
)
I tested it on both Mongo shell and Compass, it all worked as expected, connected with correct password, and denied with the wrong one.
Then I created a C# windows form app, use NuGet to install all required packages such as MongoDB.Driver for C#(v2.11.0) and its related packages such as MongoDB.Bson, etc
After that, I used the following code to create a MongoClient:
MongoClient client = new MongoClient( "mongodb://superuser:12#localhost:27017" );
So I expected it should throw an exception because I used the wrong password, "12" in this case. But it didn't. Then I tried to list database names with:
client.ListDatabaseNames();
It threw a timeout exception: "A timeout occured after 30000ms selecting a server using CompositeServerSelector"
Even I used the correct password or turned off the authorization, and just go with "mongodb://localhost:27017" or ""mongodb://127.0.0.1:27017", it still threw the same timeout exception.
It feels like something wrong with that client it created which caused the timeout issue later on. But I couldn't figure out what I am missing.
Thank you for your help!
Edit:
The same code works perfectly in a console app, just not a windows form app, which really confuses me.
After trial and error for 2 days, I finally found a work around for this issue, still don't know why this works though.
So basically I have to split the MongoClient creation and its following function calls separately. I can't do anything related to the MongoClient right after its creation. For example, the following throws the time out exception:
MongoClient client = new MongoClient( "mongodb://localhost:27017" ); //I turned off authorization
client.ListDatabaseNames(); //Throw time out exception here!!!
I have to split them separately in 2 functions call, like one in a "Connect" button event, another one in a "ListDatabaseNames" button event.
Once I did that, everything works fine.
mongodb://superuser:12#localhost:27017?authMechanism=SCRAM-SHA-1
because dotNet not support SCRAM-SHA-256 yet
Creating a client does not perform any network operations like connecting to your MongoDB deployment - that is done in background. Hence incorrect credentials won't make client creation fail.
mongo shell works differently and compass probably performs some queries that would fail if credentials aren't correct.
Why you are getting a timeout error - my guess is it's an ipv4/ipv6 difference. Try 127.0.0.1 instead of localhost. If this doesn't help enable debug information in your driver.

getting "ORA-01017: invalid username/password;logon denied" exception after installing Zulu

I am trying to establish an oracle database connection using connection string
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HOSTNAME)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=SERVICENAME)));User Id=/;
in C# native application. Here I am using operating system authentication.
When I was using jdk1.8, it was working fine but since I moved to zulu8, it is throwing exception
"ORA-01017: invalid username/password;logon denied".
This is the only change that happened over the period.
I am clueless how to solve this issue. Please help.
It looks like the connection string is not providing the full credentials. Connecting locally to oracle you can use / as a qualifying username and password via sqlplus, as the database is configured by default to do that. Otherwise, you have to specify the full username and password:
you can go here and get a good format for your connection string as if varies based on your connection method:
https://www.connectionstrings.com/oracle/

APNS implementation in C#

I am trying to implement push notification services in windows by following this link.
Starting from MAC I am able to create SSL certificate(cer) and key (p12) files. I also installed these two files on Windows server by following this link.
Now the issue is, when I execute .Net code, I am able to send a message but in the response I'm getting an exception. When it goes into the ReadResponse it gives the error Input string was not in a correct format on this line :
payLoadIndex = ((Convert.ToInt16(payLoadId)) - 1000);
It happens because payLoadId is blank. It says that "Notification successfully sent to APNS server for Device Token" but I get no notifications. I assume if this ReadResponse worked I would be able to know what the error was.
One thing I noted in some post is that after following the above procedure they create the PKCS12 format file for the notifications to work, using OpenSSL.
If this is required, which key should I use, "p12" or "PKCS12"?

RavenDB BulkInsert() fails with 403 Forbidden

I've recently migrated my environment and now a process that uses BulkInsert is not working. It is resulting in a 403 Forbidden response from the db server.
The previous environment had the database running as a Windows service on the same server as my application and access was set up differently. Now I'm using RavenHQ on a remote host, using an API Key. I'm sure the privileges have changed so I'm wondering if that's why BulkInsert is resulting in 403 error.
I've searched but I cannot find anything that explicitly states what privileges are required for the various raven operations. My understanding from this post is that there are at least some that require higher privileges. Can anybody point me to documentation on specifics? Or otherwise shine some light on the subject? Thanks.
I had this same problem and I think it's because the example connection string RavenHQ gives you containing your API key does not actually include your database name.
Try adding ";Database=[myDb]" to the end of your connection string URL or passing your database name explicitly as the first parameter to bulkInsert()

Categories