Error when using postgresql with pgOleDb provider and long string parameter - postgresql

I'm using postgresql with pgOleDb provider. When i try to execute query where wone of the parameters longer than 35 symbols (i'm using utf-8), i recive this error
ERROR: identifier too long
DETAIL: Identifier must be less than 64 characters.
There is no problems when running this query with Ado.Net provider from devart. How can i solve it?
Provider from this site: http://pgfoundry.org/frs/?group_id=1000085

Switched proveder to official ODBC http://www.postgresql.org/ftp/odbc/versions/msi/

I know it's a bit old now, but I could not solve this using ADO components so used ZEOS components successfully

Related

EF Core 3.1 using Authentication=Active Directory Integrated

[Update 1]
I could make it work using the following connection string
Server=tcp:mydatabaseserver.database.windows.net,1433;Initial Catalog=mydbname
and implementing an interceptor as mentioned in this article.
This proves that Azure is correctly configured, and the problem is somewhere in the application (maybe a missing package?).
Anyway, I would still like to be able to change the connection string and switch between AAD authentication and sql authentication, without additional logic in the application.
[/Update 1]
I'm using EF Core 3.1.4 on an Azure WebApp, and I would like to use the Azure AD identity assigned to the application for authentication, but I run into the following exception:
ArgumentException: Invalid value for key 'authentication'.
Microsoft.Data.Common.DbConnectionStringBuilderUtil.ConvertToAuthenticationType(string keyword, object value)
This is the connection string:
{
"ConnectionStrings": {
"Admin": "Server=tcp:mydatabaseserver.database.windows.net,1433;Initial Catalog=mydbname;Authentication=Active Directory Integrated"
}
}
I initialize the context using the following code:
var connectionString = this.Configuration.GetConnectionString("Admin");
services.AddDbContext<NetCoreDataContext>(builder => builder.UseSqlServer(connectionString));
The Microsoft.Azure.Services.AppAuthentication package is also imported (version 1.5.0)
Active Directory Integrated wasn't working for me in .NET Core 3.1 but it works now ever since I installed the NuGet package Microsoft.Data.SqlClient (I installed version v2.0.1). It now works with the following connection string:
"MyDbConnStr": "Server=tcp:mydbserver.database.windows.net,1433;Database=MyDb;Authentication=ActiveDirectoryIntegrated"
Note: it also works if I have spaces between the words like this:
"MyDbConnStr": "Server=tcp:mydbserver.database.windows.net,1433;Database=MyDb;Authentication=Active Directory Integrated"
And it also works if I include escaped quotes like this:
"MyDbConnStr": "Server=tcp:mydbserver.database.windows.net,1433;Database=MyDb;Authentication="Active Directory Integrated""
Finally, note that there are additional properties which can also be used in the connection string:
;User ID=myruntimeuser#mydomain.com;Persist Security Info=true;Encrypt=true;TrustServerCertificate=true;MultipleActiveResultSets=true
Welcome to the Net frameworks/runtimes hell.
Currently ActiveDirectoryIntegrated and ActiveDirectoryInteractiveauthentication options are not supported for NetCore apps.
The reason is that starting with v3.0, EF Core uses Microsoft.Data.SqlClient instead of System.Data.SqlClient. And the most recent at this time version of Microsoft.Data.SqlClient (also the preview versions) supports these two options only for NET Framework.
You can see similar question in their issue tracker Why does SqlClient for .Net Core not allow an authentication method 'Active Directory Interactive'? #374, as well as the documentation of the SqlAuthenticationMethod enum - ActiveDirectoryIntegrated (emphasis is mine):
The authentication method uses Active Directory Integrated. Use Active Directory Integrated to connect to a SQL Database using integrated Windows authentication. Available for .NET Framework applications only.
With that being said, use the Authentication workaround, or wait this option to be eventually implemented for Net Core.
Upgrading the Nuget packages:
Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.SqlServer to 6.0.1 and using Authentication=Active Directory Managed Identity in the connection string helped me resolve the issue.
UPDATE
If you use azure msi, pls read this document.
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi
PRIVIOUS
Your problems maybe not configure in portal. You can follow the offical document to finished it, then try again.
First, you need to create SQL managed instances which maybe cost your long time. Then u need to configure Active Directory admin and your db. When you finished it, you will find ADO.NET(Active Directory password authentication) in your SQL database ->Connection strings in portal. You can copy and paste it in your code to solve the issue.
I have tried it by myself, and it works for me. For more detail, you can see this post.

Could not initialize class com.ibm.ws.ffdc.FFDCFilter. DSRA0010E: SQL State = 28P01, Error Code = 0

Can I get assistance with the error codes coming from eclipse when I try to deploy enterprise application on websphere. I followed craig st jean, I also face another problem with configuration i.e websphere data sources using postgresql. i am using a windows machine, 64bit arch. the error codes are the topic of this question. i hope this question can be seen as relevant, since not much solutions exist for the first issue concerning com.ibm.ws.ffdc.FFDCFilter, thus if one doesn't overcome the first, how can one press on and attempt to solve the second. thanks.
Webspere logs
The test connection operation failed for data source AppDb on server server1 at node Lenovo-PCNode01 with the following exception: java.sql.SQLException: FATAL: password authentication failed for user "listmanagerremote" DSRA0010E: SQL State = 28P01, Error Code = 0. View JVM logs for further details.
I have fixed the issues with deployment in the eclipse neon IDE. I think it is either as a result of the installation of the IBM WebSphere Application Server Traditional v8.0x Developer tools for Neon, and IBM jre.
Eclipse console final message
00000063 CompositionUn A WSVR0191I: Composition unit WebSphere:cuname=ListManager in BLA WebSphere:blaname=ListManager started.
Postgre documents the 28P01 SQL State as an invalid password:
"28P01 INVALID PASSWORD invalid_password"
https://www.postgresql.org/docs/9.0/static/errcodes-appendix.html
Check your data source configuration to ensure that you have specified the correct password, or if using an authentication alias for your data source, confirm that the authentication data configuration contains the correct password, and that you have configured the data source and/or resource reference to use that authentication data.

Rails 5 Upgrade Issue: database configuration does not specify adapter

I received the following error after upgrading my application to Rails 5 and it is somewhat cryptic:
...connection_specification.rb:170:in `spec': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
I found the solution to this problem, it turns out that in my case since I was connecting to multiple databases that there was a subtle change in what Rails 5 expected over Rails 4.
If you are connecting to multiple databases the establish_connection used within the model connecting to the separate database requires a symbol instead of a string in Rails 5.
Works
establish_connection :secondary_database
Where as the following no longer works:
establish_connection "secondary_database"
In my case some of my old database connections had used the string argument and were failing, causing me to think that there was an strange incompatibility between Rails 5 and my code base. I thought I would share this as I do not see it documented anywhere specifically.

Security vulnerabilities with quoting in SQL

i am doing a simple select using the zend\db\sql classes and i got the following error.
Notice: Attempting to quote a value in Zend\Db\Adapter\Platform\Mysql
without extension/driver support can introduce security
vulnerabilities in a production environment. in
C:\wamp\vendor\zendframework\zend-db\Zend\Db\Adapter\Platform\Mysql.php
on line 134
Below is my code that output the errors.
$select2 = $this->sql->select()
->from('users')
->where(array("fbid = ?" => $id));
$selectSqlString = $this->sql->getSqlStringForSqlObject($select2);
$this->dbo->query($selectSqlString, Adapter::QUERY_MODE_EXECUTE);
May i know why does this happens and what should i do to prevent it?
Cheers~
By looking at the code for the MySQL class (I know that the provided link is for ZF2, but it looks like the same code is used), it would seem, that you are missing both the PDO and mysqli extension. That would mean that you are currently using mysql extension to connect to MySQL db, which is deprecated.
As a solution, I would recommend installing mysqli.

Entity Framework uses SqlCeCommand when I try to connect to Azure database

I am using two databases in the project: Azure and Sql Compact. Entity Framework was generated using Compact database, but now I am trying to use it to connect to Azure database with the same schema passing to Context constructor Azure connection string:
but when it tries to get some data it gives me the exception:
"SqlCeCommand.CommandTimeout does not support non-zero values."
Why it uses Compact command if provider is specified correctly? How I can fix this?
http://www.codeproject.com/Articles/82017/Preparing-an-Entity-Framework-model-for-multi-prov.aspx
this may not have been the cause of your issue but I received this error when I had manually set the command timeout for the SqlCeCommand that I was using to connect to my Compact Edition database.
This is the setting I removed:
cecmd.CommandTimeout = 720;
I hope this helps someone else!