Error when running database script Report Server Configuration Manager - configuration

I am trying to configure a Report Server Database in the Report Server Configuration Manager and I get the error when it gets to the running database script. enter image description here
System.Data.SqlClient.SqlException (0x80131904): The object 'classified' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
The object 'classified' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
The object 'classified' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
The object 'classified' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
The object 'classified' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
CREATE DATABASE failed. The default collation of database 'ReportServer' cannot be set to 'Latin1_General_100_CI_AS_KS_WS'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.ReportingServices.Common.DBUtils.ApplyScript(SqlConnection conn, String script, ICommandWrapperFactory commandWrapper)
at Microsoft.ReportingServices.Common.DBUtils.ApplyScript(String connectionString, String script)
at ReportServicesConfigUI.SqlClientTools.SqlTools.ApplyScript(String connectionString, String script)
Can anyone help, please?

I solved the problem.
It turned out that we put some stored procedures and functions in the Model database, which is used as the template when SQL Server creates a new database, and those objects were preventing the server from changing the collation of the new database.

Related

Getting error "A network-related or instance-specific error occurred while establishing a connection to SQL Server" when using MySQL and Authorization

I have an ASP.NET project running on .NET Framework 4.8 and using MySQL for the database. Everything was working fine, till I decided to user Authorization. I have the following:
[Authorize(Roles = "Admin")]
public class ApproveActionsController : DaysOffBaseController
{
}
The moment I try to access the URL: https://myApp/DayOffModule/ApproveActions/ApproveDaysOffList
I'm getting the following error message and the app is throwing SqlException
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I have read a lot and it looks like it's thinking that it thinks I'm using SQL Server or trying to connect to it. I have tried looking everywhere in the app for System.Data.SqlClient and changed it to MySql.Data.MySqlClient but it's still throwing the same Exception.
When I remove the [Authorize(Roles = "Admin")] from the controller above - I'm not having this issue.
Here is the entire stack:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the application's App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
If the application is running on either Windows 7 or Windows Server 2008R2, special configuration steps are necessary to enable automatic creation of the provider database. Additional information is available at: http://go.microsoft.com/fwlink/?LinkId=160102. If the application's App_Data directory does not already exist, the web server account must have read and write access to the application's directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the application's App_Data directory already exists, the web server account only requires read and write access to the application's App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the application's App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server account's credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager) +1524
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +706
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) +57
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +1186
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +315
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +128
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +265
System.Data.SqlClient.SqlConnection.Open() +133
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +82
[HttpException (0x80004005): Unable to connect to SQL Server database.]
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +175
System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +121
System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +57
System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +475

LOAD DATA LOCAL INFILE file request rejected due to restrictions on access (ODBC)

Oh my, how do I even start asking this question.... I have a feeling this has been answered more than ones but I'm too dumb to understand the answers.... So I'm sure I'll be roasted for lots of reasons, but I'm feeling brave today.
I'm trying to automatically update my Database with a .csv file I receive daily.
Biggest issue I have is that I have no coding experience and my SQL is extremely limited so when I search for help regarding this issue I .... don't really know what to do with the information.
In order to get Power Automate (desktop) to connect to the server I had to install ODBC Data Sources to create a connection string. Then I tried a simple query to make sure i have connection, and this works fine.
Now, for the actual query I want to run;
"LOAD DATA LOCAL INFILE 'C:\Automation\Lagerførte Artikkler.csv' REPLACE INTO TABLE ......
I get this error;
Error in SQL statement ERROR [HY000] [MySQL][ODBC 8.0(w) Driver][mysqld-5.5.5-10.5.18-MariaDB-1:10.5.18+maria~ubu2004-log
LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.
Detailed Error;
ERROR [HY000] [MySQL][ODBC 8.0(w) Driver][mysqld-5.5.5-10.5.18-MariaDB-1:10.5.18+maria~ubu2004-log]LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.: Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Error in SQL statement ERROR [HY000] [MySQL][ODBC 8.0(w) Driver][mysqld-5.5.5-10.5.18-MariaDB-1:10.5.18+maria~ubu2004-log]LOAD DATA LOCAL INFILE file request rejected due to restrictions on access. ---> System.Data.Odbc.OdbcException: ERROR [HY000] [MySQL][ODBC 8.0(w) Driver][mysqld-5.5.5-10.5.18-MariaDB-1:10.5.18+maria~ubu2004-log]LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at Microsoft.Flow.RPA.Desktop.Modules.Database.Actions.DatabaseActions.ExecuteSQLStatement(Variant connectionString, Variant sqlConnectionVariable, Variant sqlCommand, Variant& result, Int32 timeout, Int32 getConnection)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.Database.Actions.ExecuteSqlStatement.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)
If I change the path to something non existing I get same error.
If I run this query in HeidiSQL it works fine. Also tried to run it through SQL plugin for VS, and this also works fine. (The pathing then is C:\Users\UNRAID~1\DOCUME~1\AUTOMA~1\LAGERF~1.CSV)
If I delete the LOCAL part in the query I get this error;
Access denied for user 'cncportalenno01'#'%' (using password: YES)
What I don't understand is how this user has no access when it clearly has access when going through heidi or vs ? (This might be a dumb take, but as I said, I'm .... lost)
Any help, or guidance wound be greatly appreciated, spent 20h on this f... issue already.
Also tried to put the csv file in Public (Users) folder and just on C:
There is also this checkbox in ODBC Data source config which states "Enabled LOAD DATA LOCAL INFILE statements" but this is an option which do not save. How to overwrite this setting I have no clue.
ODBC Settings
I managed to get this bloddy thing fixed by using "MariaDB ODBC 3.1" Driver rather than "MySQL ODBC 8.0 Driver".....
Relief and anger at same time sure feels wierd.
The server needs local_infile=1 enabled. Given HeidiSQL worked we can assume this is set.
The second requirement is the client connection needs to connect with a local_infile flag set.
In ODBC, this is the OPTIONS with bit 7 set aka 128 (2^7).

For MYSQL 5.7.31 - Which Timeout variable should be changed for a transport connection: Connection timed out

I'm using mysql 5.7.31 with C# on Linux ubuntu
When I programmatically delete a large table or drop a database I get this timeout
Stack=MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command execution.
---> MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered attempting to read the resultset.
---> MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed.
---> System.IO.IOException: Unable to read data from the transport connection: Connection timed out.
---> System.Net.Sockets.SocketException (110): Connection timed out
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
To fix this I've attempted
I added this to my connection string
Connect Timeout=60
I added this to my mysqld.cnf, Restarted and checked it show variables. The log file shows it timed-out after 42 seconds.
connect_timeout=60000
interactive_timeout=60000
wait_timeout=60000
I think the issue is "Unable to read data from the transport connection: Connection timed out."
But not sure which variable needs to be changed to fix this?
Thanks
connect_timeout is used only when the client and server are performing a handshake, during the initial client connection. Increasing this helps if the client gets errors like Lost connection to MySQL server.... The default is 10 seconds.
I've never had a reason to tune this variable, because if the client can't connect within 10 seconds, it's probably blocked by a firewall, or routing, or else the MySQL Server is simply not running or is listening on another port. Increasing the timeout will not help in these cases.
wait_timeout helps the client is idle for a long time between queries. The client is not considered idle if the query executes for a long time. The idle time starts when a query finishes. The default is 8 hours (28800 seconds). If your app is timing out during an SQL statement execution, then this variable is not relevant.
interactive_timeout is just like wait_timeout, but for "interactive" clients. The only client that is in this category is the mysql command-line client. You can ignore this timeout variable, unless you're working on the mysql CLI.
You might need to tune net_read_timeout or net_write_timeout. But I wouldn't expect either of these to be necessary.
Tip: Use XFS as the filesystem for the MySQL datadir on Linux. It's much faster to drop tables or schemas, regardless of how large they are. XFS gives better performance for other work too, not just dropping tables.

SQL Azure: "The instance of SQL Server you attempted to connect to requires encryption but this machine does not support it"

I'm getting the following SQL exception intermittently when my Azure worker role is trying to connect to an Azure SQL Database to call ExecuteCommand, using LINQ-to-SQL:
"The instance of SQL Server you attempted to connect to requires encryption but this machine does not support it."
Google seems to know nothing about this error message. The stack trace shows it's failing during the pre-login handshake:
System.Data.SqlClient.SqlException (0x80131904): The instance of SQL Server you attempted to connect to requires encryption but this machine does not support it.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(Boolean encrypt, Boolean trustServerCert, Boolean& marsCapable)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject, Boolean withFailover)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user)
at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe()
at System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode()
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
at System.Data.Linq.DataContext.ExecuteCommand(String command, Object[] parameters)
I've found reports of other, similar errors that were due to various issues in the pre-login handshake (wherein it just fell back to a similar error message for any problem in the handshake), and others where the SQL Server "Force Encryption" setting needed to be changed, but since this is an Azure SQL Database I can't go in and change this setting in SQL Server and don't really expect I would need to.
Since I can't find anything else on this specific error, and it's not happening every single time, I'm not sure where to look. Any pointers as to where to look from here?
EDIT: Until shown otherwise, I'm chalking this one up to transient errors due to heavy traffic on the DB server from another one of my hosted services. Details in a follow-up question I asked: Can two Azure SQL databases on the same server affect each other's performance?
I've had this issue this morning, I could connect to my sql azure instance from my machine, could log in through the sql azure management portal but not through my azure website.
the solution in the end was to go into the dashboard for the azure website and add the database as a linked resource.
not very obvious and maybe a coincidence but for the time being it works.

MySQL Connector/Net with SSL from WCF Service fails

I'm trying to achieve the following with no success so far:
Certificate based SSL connection to an external MySQL database (v5.0) from my WCF service (hostet in IIS 7.5 on Server 2008 R2) using Connector/Net.
The guys that host the mysql db have sent me three .pem files, which I combined to a single .pfx using OpenSSL, as described in Using SSL with MySQL Connector/Net.
But when I tried to connect using the file-based approach, I got an exception that told me that mysql 5.0 doesn't support file-based mode.
So I was left with but one option: store-based certificate.
Therefore I installed the certificate on the server (hosting my wcf service) for "Local Computer", adding it to "Personal Certificates". Then after adjusting the connection string to contain
"SSL Mode=Required;Certificate Store Location=LocalMachine;"
I tested again, with some weired authentication/credential errors.
After google'ing some more, I found that there might be a problem with insufficient access rights to the certificate. So I followed the steps explained here, and used the tool WinHttpCertCfg to grant access for the account "NetworkService", which I believe is used for hosting my service.
Unfortunately I still get the following exception:
Message: Out of sync with server
Source: MySql.Data
Type: MySql.Data.MySqlClient.MySqlException
StackTrace:
bei MySql.Data.MySqlClient.NativeDriver.ReadOk(Boolean read)
bei MySql.Data.MySqlClient.NativeDriver.AuthenticateNew(Boolean reset)
bei MySql.Data.MySqlClient.NativeDriver.Authenticate(Boolean reset)
bei MySql.Data.MySqlClient.NativeDriver.Open()
bei MySql.Data.MySqlClient.Driver.Open()
bei MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
bei MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
bei MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
bei MySql.Data.MySqlClient.MySqlPool.GetConnection()
bei MySql.Data.MySqlClient.MySqlConnection.Open()
bei System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
bei System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
bei System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
bei AtlasService.AtlasService.getChildNodes(UInt32 nid, Language lang, Boolean withEmpty, DateFormats format)
Does anyone know what the problem is here, or what I'm doing wrong?
Any help would be greatly apreciated.
Thanks in advance
/EDIT: I should add that I successfully tested the ssl connection using mysql commandline tool and workbench (with the separate .pem files)
Ok after hours of frustration I found a solution.
It seems that there is a problem with the latest version (v6.4.3) of the connector/net lib or the combination of ssl with the versions of connector/net lib and mysql server in use.
After downgrading the connector/net lib to v6.3.7 everything works fine.