Subsonic not working with MySQL (5.0.51a) - mysql

I am trying to use Subsoinc 3.0.0.1 to connect to mysql db.
I added dll reference and connection string to app.config
Then I copied templates from ActiveRecord folder to folder in my solution and edited namespace and connection string but then i get this error:
Error 10 Running transformation: System.Data.SqlClient.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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
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 Microsoft.VisualStudio.TextTemplatingB345C0F834877921095C8F23912FC356.GeneratedTextTransformation.GetReader(String sql)
at Microsoft.VisualStudio.TextTemplatingB345C0F834877921095C8F23912FC356.GeneratedTextTransformation.LoadTables()
at Microsoft.VisualStudio.TextTemplatingB345C0F834877921095C8F23912FC356.GeneratedTextTransformation.TransformText() C:\Users\Hex\Documents\Visual Studio 2008\Projects\Ceger\Ceger.DAL\Models\Structs.tt 1 1
Then i found MySQL.ttinclude and Settings.ttinclude in TemplateProviders and replaced files form ActiveRecord with them but that didnt change everything.
I also tried with LinqTemplates.

Like the README says :) you need to use the MySQL.ttinclude in the TemplateProviders folder...

Now i got it.
I have to rename MySQL.ttinclude to SQLServer.ttinclude or to manualy change all reference in all files from SQLServer.ttinclude to MySQL.ttinclude.
and Settings.ttinclude in TemplateProveders folder is not needed. (it has been removed from 3.0.0.2)

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

(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Additional information: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) .
I'm trying to connect to my online database from my vb website project but always getting the error above
i tried to change the server name to an ip,localhost but still the same problem !
my connecting string
cnn.ConnectionString = "server=mrsandg.com; user=username ;password=password ;Database=my_db;"
i checked
Connecting to a Online MySQL Database using VB.Net
SqlConnection error Named Pipes Provider
https://www.daniweb.com/programming/software-development/threads/488146/how-to-connect-vb-net-on-a-online-database
Your problem is that you are using a System.Data.SqlClient.SqlConnection in an attempt to connect to a MySql server.
To connect to MySql you need to use a MySqlConnection which will require you adding a reference MySql provider for Ado.Net called MySql.Data
The easiest way to do this is by using NuGet Package Manager. In Visual Studio Click: Tools > NuGet Package Manger -> Manage Nuget Packages For Solution.
In the form, click on Browse and select MySql.Data.
Note: there is also an EntityFramework provider if you wish to use that instead of Ado.Net.
From Here, check the projects you want to use the provider in and click install.

Why am I unable to connect Sql server 2008 R2 from tibco BW?

When I'm trying to connect to sql server from tibco JDBC connection getting the following errors.
For com.microsoft.sqlserver.jdbc.SQLServerDriver
BW-JDBC-100034 "Configuration Test Failed. Exception [com.microsoft.sqlserver.jdbc.SQLServerException] occurred. com.microsoft.sqlserver.jdbc.SQLServerException: Software caused connection abort: recv failed"
and for tibcosoftwareinc.jdbc.sqlserver.SQLServerDriver
BW-JDBC-100033 "Configuration Test Failed. Failed to find or load the JDBC driver: tibcosoftwareinc.jdbc.sqlserver.SQLServerDriver"
I've placed the jar files in C:\tibco\tpcl\5.7\lib folder and also tried by placing the jar files in C:\tibco\tpcl\5.7\jdbc folder.
Can any please let me know how to solve this problem?
you should put the jar files in tibco bw/lib folder.
For me its C:\tibco\bw\5.10\lib
Additionally if you want to connect ms sql server using windows authentication then you also have to keep windows/system32 folder or add to class path.
Your JDBC drivers should be placed in:
C:\tibco\tpcl\5.7\jdbc
You must create the jdbc folder if it doesn't exist.
I had the same problem and Its resolved now.
First - Check If you are able to connect to a different Sql server using the JDBC connection in Tibco designer. If yes - there is an issue with the Sql server in your machine.
You should upgrade to Sql Server 2008 Service Pack 2. I did, restarted my Sql server and was able to connect. Download it from here. Also you need to make sure you have the jdbc folder in your C:\tibco\tpcl\5.7\ and you have the corresponding class path tibco.env.STD_CP_EXT in the designer.tra.
Just FYI, a relevant fix is in in SP2 patch:-
http://support.microsoft.com/kb/2653857
FIX: You cannot connect to SQL Server by using JDBC Driver for SQL Server after you upgrade to JRE 6 update 29 or a later version

IIS SQL connection fails under heavy load; reset IIS fixes temporarily

Server 1: SQL Server 2008 Standard Edition
Server 2: Windows 2008 Server R2, IIS 7.0
A web-site on Server 2 requires data in SQL Server on Server 1.
Everything works fine for a while (weeks sometimes). Then, under heavy load, Server 2 reports it cannot connect SQL Server on Server 1. Once IIS on Server 2 reports it cannot connect to SQL on Server 1, it does not get better until IIS on Server 2 is restarted. Perhaps restarting the application pool would work as well as a full IIS reset. I'm not certain.
I've tried changing the connection string to increase the connection pool size to unreasonably large values (1,000). The failures still happen.
The web-site is written in C#. The data access layer is NHibernate.
Here is the start of the exception:
[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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +428
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
NHibernate.Connection.DriverConnectionProvider.GetConnection() +60
NHibernate.Impl.SessionFactoryImpl.OpenConnection() +39
Any ideas why this is happening? How to diagnose/fix it? I'm frustrated and considering ripping out NHibernate, which will take months and probably lead to many other kinds of problems.
I think you have to increase connection timeout value and connection pooling as well. So that it won't release connection to SQL Server in heavy load.
The fix for me was to configure SQL server to allow an unlimited number of connections (set to value of "0"). I still had a few connection issues as described in the original post, but no where near as much. So I also setup a direct connection to the SQL server via the secondary Ethernet port on each server (Webserver to SQL Server),and kept the connection private using 196.168.1.x between the servers, and using it's own Ethernet switch not connected to the public switch.

Entity Framework 4.1 The provider did not return a ProviderManifestToken string Exception

I downloaded the Asp.NET MVC 3 EntityFramework Code first sample application in vb.net and modified the connection string as I don't have SQL Server Express Edition to try it with Sql Server 2008 Web Edition
<add name="ApplicationServices"
connectionString="Server=MyPC\Sql2008;Trusted_Connection=True;MultipleActiveResultSets=True"
providerName="System.Data.SqlClient" />
when I try to run the application then ProviderIncompatibleException exception is thrown. And following error is displayed in the browser window.
Server Error in '/' Application.
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: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server)
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.
Exception Details: System.Data.SqlClient.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: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
Line 24:
Line 25:
Line 26: #For Each item In Model
Line 27: #
Line 28:
Source File: C:\Documents and Settings\Shishir Shukla\My Documents\Downloads\CodeFirstEFVB\CodeFirstMVC\Views\Blog\Index.vbhtml Line: 26
The connection string which I have used works perfectly with my asp.net webforms application and also Winforms application.
Please help me soon to get rid of this problem as I have just switched to MVC.
The problem was with the connection string , I changed it to this and it worked ..
<add name="DBCon" connectionString="Data Source=.\SQL2008;Initial Catalog=TestDB;Integrated Security=True" providerName="System.Data.SqlClient" />
Can you provide a link to the project you downloaded?
You are using Windows Authentication, does the IIS account have permissions to the db?
Finally, verify your dbContext class is named "ApplicationServices". Otherwise, you may need to use the constructor that takes in a nameOrConnectionString.
Your connection string is a valid SQL connection string, but you need an Entity Framework connection string.
When you create your EF Model, create a new connection string from scratch. That will resolve this issue.
You can look at the new conneciton in your web.config, and you wil see that an Entity connection contains additional metadata as part of the connection string, and wraps the SQL conneciton string.
UPDATE:
A valid Entity connection string will look something like this:
<add name="MyDatabaseEntities" connectionString="metadata=res://*/Models.MyDatabase.csdl|res://*/Models.MyDatabase.ssdl|res://*/Models.MyDatabase.msl;provider=System.Data.SqlClient;provider connection string="data source=SERVER;initial catalog=MyDatabase;persist security info=True;user id=userid;password=password;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
However, you should let Visual Studio build the connection string for you.