I'm currently working on a ASP.net website, I have everything working and wanted to deploy it to the server which is goDaddy to test the changes I made. I have had this code, the exact same project with the identical database connection string and calls on the server before. Nothing changed really I just changed one method in a class which has nothing to do with the database at all. I have the code trust set to full so the code should have permission to connect. When I set the code trust lower then full it will give me an error that I don't have the needed permissions so I'm sure this isn't where the problem lays.
Like the title says when I try the code on my local environement everything works just fine. When I try to do the same thing on the server I get a message saying:
"unable to connect to any of the specified MySQL hosts"
when you go to http://test.ceremoniecompleet.nl/admin and try to log in you will get the error. When I try to login locally it works just fine.
The connection string I'm using is as follows
con.ConnectionString = "server=188.121.44.188; database=CeremonieCompleet_DB; uid=CCU; pwd=mypassword;";
I've tried to use 188.121.44.188:3306 but this doesn't work at all. One of the godaddy support people suggested using this but this just fails on both locally and the server.
does anyone have any clue what could be going on?
the only thing that changed really is that I used visual studio 2012 before and now I'm using visual studio 2015 because my pc needed a completely fresh install.
EDIT:
Currently the mysql.data.dll that I added to the project is version 6.0.3.0 could it be that this just needs an upgrade?
The 188.121.44.188 is the godaddy server?
If it is, try changing to 'localhost'.
If it isn't, try to create a database in godaddy and set the server to 'localhost'.
To set the port, you need this string "server=<>; port=3306; ..."
Related
I am creating a POS system in Windows Forms (C#) in which I use a SQL Server database file (.mdf) to store items (completely offline). When I install the application on my computer, it works fine, but when I install it on my clients PC, an error happens:
(provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation"
I read somewhere that the problem is caused due to the fact that the connection string of the database of my client's PC is different. I tried to add the connection string dynamically on runtime but again it only worked on my computer.
Another reason that might be causing the problem is that I used 'server-based database' since local database option isn't available in Visual Studio 2017 for some reason.
Another solution I looked up stated that I should install SQL Server Express on my client's PC. That also failed (maybe I have to set it up in a way or something).
I also tried adding the database.mdf and database_log files in the setup folder.
Lastly I tried installing 3rd party installers (Advanced installers 15.8 and InstallShield Wizard in VS 2015) which also failed.
(I have provided the code for the connection of database taking place and the connection string)
public void ConnectToDB()
{
DBConnection = new SqlConnection(#"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename=C:\Users\SAIM NASSER\Desktop\app layer\data layer\Database1.mdf; Integrated Security = True");
DBConnection.Open();
ResultSet = new DataSet();
}
If I understand you correct, you want to use LocalDB
That means using Sql Server without installing a full sql server, but just the localdb part from sql server express.
For this to work you need to install the LocalDB Driver, which can be found here
https://www.microsoft.com/en-us/download/details.aspx?id=29062
You need only the ENU\x64\SqlLocalDB.MSI
This is the only thing you need to install in your clients computer, I believe it can also be installed silent, you have to research a bit for that.
And yes, you also should change the connection string on the clients computer, you need to alter it so it points to the MDF file on the clients computer, because that location will probably be different then on your computer
EDIT
To get the connection string working, you can try this
On the clients computer, create a text file and rename the extension to .udl
So for example you have a file test.udl
Now from explorer, double click it, this will open the datalink editor.
From here you can enter/choose different settings, and click on the test connection button.
Once you get a working connection, save it, and open this file with notepad.
Inside you will find the working connection string
Hope this helps
I'm setting up ci-deployment using jenkins for multiplice ASP.NET MVC 5 EF CF application with MySQL-Database on a Windows Server 2012 R2 node. The app gets compiled first using msbuild and then published on IIS with msdeploy. ConnectionStrings will be replaced using the -setParamFile parameter, which works.
The problem: After calling the app on the target server, I get the following MySQL error:
MySql.Data.MySqlClient.MySqlException: Access denied for user 'myUser'#'myIp' (using password: NO).
The MySQL-Doc say that this means the clinent had tried to connect without password.
This is really confusing me because my ConnectionString certainly contains a password! In the Web.config from the folder of the IIS-App it looks like this:
<add name="MyContext" connectionString="Server=SERVERIP;Database=MYDBNAME;Uid=DATABASEUSER;Pwd=PWD;Convert Zero Datetime=True;" providerName="MySql.Data.MySqlClient" />
Which is valid, because the app is running fine on local debugging and a Windows Server 2012 R2 based testsystem, where I deployed the app using Web-Publishing function of Visual Studio.
I have the suspicion that my Web.config gets overwritten, but can't find out where and why. I took a look in the local Machine.config file of the target-server, but in contrast to another thread with nearly the same problem this isn't containing my ConnectionString (And I even can't imagine why this should gonna happen).
First of all, let me tell you that I have tried every damn thing by Googling to overcome this error and I have not done any TYPO error either. But, none of the Google results helped. Let me tell you the scenario... I installed Visual Studio Ultimate 2013 (and nothing else, no separate sqlexpress, nothing). All non-DB apps are working fine. But, for one project, when I tried to create new database connection (by right clicking 'data connections' or clicking 'connect to database' icon for creating localdb), I got this error:
"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:
sqlnetwork interfaces, error 26- Error locating server/Instance
specified)"
Then, as usual, I tried to Google for it. But most of the answers were related to sqlexpress (which I didn't installed separately). Then one answer was about "sqlserver configuration manager" and enabling sqlservices and something called surface area.... But, as "sqlserver configuration manager" was not there in my 'all programs' on my windows 8 (64x) machine, I downloaded sqlexpress and sqlserver management studio too. But an item named something like "surface area manager...." was not there. I enabled sqlservices, all tcp/ip ports. Shut down my firewall. Still getting the same error.
NOTE: I dont have any connection string in my webconfig till now because I was just going to create the new DB. So the the answer about editing conn string doesn't mattered to me.
NOTE: This was not the case with Visual Studio 2012. On only VS2012 (and nothing else) installation, it worked fine for creating the DBs and all other things. So, what's wrong with VS2013??
Server \ Instance name must be reachable from your client, as the creation of the connection string will try to verify that it connected OK. Try this from your workstation:
sqlcmd -Sservername\Instance_or_IPaddress_of_Sql_server -E -Q"select ##version"
Until you get a proper server name or instance, you will not be able to successfully create a db connection.
I'm getting the error below while starting the storage emulator. By mistake I deleted the mdf and log files in users/admin folder. It's holding reference someplace and not allowing me to create the DB again. Please help me.
Added reservation for 127.0.0.1:10000/ in user account RaviBorra-PC\Ravi Borra.
Added reservation for 127.0.0.1:10001/ in user account RaviBorra-PC\Ravi Borra.
Added reservation for 127.0.0.1:10002/ in user account RaviBorra-PC\Ravi Borra.
Found SQL Instance (localdb)\v11.0.
Creating database DevelopmentStorageDb201206 on SQL instance '(localdb)\v11.0'.
Cannot create database 'DevelopmentStorageDb201206' : Database 'DevelopmentStorageDb201206' already exists. Choose a different database name..
One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again. Please refer to http://go.microsoft.com/fwlink/?LinkID=248088 for more details.
Thank you,
Ravi Krishna B.
Do these steps:
Open cmd.exe (Command Prompt)
Write this:
SqlLocalDb stop "v11.0"
SqlLocalDb delete "v11.0"
and press Enter
Note that "v11.0" is MyInstance.
For more details, visit this link.
This problem may occur if you delete the data file C:\Users\<Username>\DevelopmentStorageDb201206.mdf but do not delete the corresponding database on the LocalDB server instance. One possible solution is:
Connect to the (localdb)\v11.0 instance from SQL Server Management Studio.
Delete the DevelopmentStorageDb201206 database. There will be the error message that the database deletion ended with an error. Ignore this message and refresh the database list manually.
Now you can start the Azure Storage Emulator.
This is not a problem related with Azure components rather LocalDB instance is reporting back to Azure request that DB still exist. Check LocalDB instances in your machine using "sqllocaldb i" first and the delete the instance using "sqllocaldb d 'instance_name'". I could not test it in my machine but this may unblock you if localdb instance is blocking you.
In Windows Azure SDK 1.7, Windows Azure Storage Emulator uses LocalDB instance specific configuration at following location:
%LocalAppData%\DevelopmentStorage\DevelopmentStorage.201206.config
And based on that you will see that v11.0 instance is Windows Azure Storage Emulator specific so verify if that is running and deleting it will let DSInit to create the DB again in LocalDB.
If you have Sql Express installed on your local box then (localdb)\v11.0 is most likely not your local Sql instance. It is more likely {MyComputerName}\SQLEXPRESS.
Going to:
C:\Users\<yourloginname>\AppData\Local\DevelopmentStorage\DevelopmentStorage.201206.config
And changing:
<SQLInstance>(localdb)\v11.0</SQLInstance>
To:
<SQLInstance>{MyComputerName}\SQLEXPRESS</SQLInstance>
solved this error for me.
I hope this helps..
If you already tried and failed perform:
SQLLocalDB stop v11.0
SQLLocalDB delete v11.0
Delete all the files in C:\Users\<accontname>\WAStorageEmulatorDb* (usually one mdf and one ldf)
Create a new account (I called it Azure, with administrative rights)
Run again the installation
Installation completed!
For me this works... I had tried to format the PC before use this way. I supposte my problem is related to my username that contains "invalid" characters like Name 'NickName' Surname while the "Azure" account seems to be OK for him.
I figure it out 'cause somewhere in the log I have a property destination path set to "C:\Users\Name$_" that is far away for the path of my user account folder.
After that you can go on CMD.exe and prompt:
control userpasswords2
From the control you can delete the Azure login without delete the file folders!
Hope it helps!
I simply deleted all the mdf's and ldf's in C:\Users\accountname\ that started with DevelopmentStorage... or WAStorageEmulator.
Re-ran the install and it worked.
This can also be caused by the folder not existing for localDB. It looks like Visual Studio / Azure will not automatically create containing folders. I just copied the path from the error code into explorer and created the directory up to the .MDF file.
In visual studio go to Tools -> Options -> Database Tools-> Data connections and change a localdb instance name from v11.0 to some other name.
I did have SQL Express installed, as Brian Ogden suggested in his answer, but I wanted to try & point Azure Storage Emulator to my SQL Express instance without modifying configuration files.
I did this by running the initialization process for Storage Emulator & passing my server\instance details for SQL Express using the available switches. Below example of the command I executed (from an elevated command prompt):
AzureStorageEmulator.exe init -server MY-PC-NAME -instance MYSQLINST
This created the database successfully (in my SQL Express instance) & got my Storage Emulator working.
I am using a named instance, but I'm thinking this same approach can be used for default instances by omitting the -instance switch.
I have a small c# wpf app for doing some simple calculations running off a Sql Express 2008 R2 db, and in the setup section is a backup button that runs the code
using (DTZDataContext db = new DTZDataContext())
{
db.ExecuteCommand(string.Format("BACKUP DATABASE DtzDb TO DISK = '{0}'", filename));
}
The connection string I am using is
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\App_Data\DTZ.mdf;Integrated Security=True;User Instance=True;Database=DtzDb
I have confirmed there are no other open db connections at this point in the application and the backup runs fine in debug, but once I compile for release (running from VS or as standalone) I get the error:
Operating system error 32 “32(failed to retrieve text for this error Reason 15105)” BACKUP DATABASE is terminating abnormally.
How can I fix this, preferably without having to install Sql Management Studio on each machine and attaching the DB? What is the recommended way of doing backups? Why does it work in Debug but not Release.
Many Thanks
My bad... It turns out VS had changed the DataContext connection string to DTZConnectionString1 and made another settings file. Now I am using the correct connection string it is working fine.
No idea why the incorrect one worked in debug but not release.