I'm new to ASP.NET (as you will be able to tell, i'm sure ; )
I can't connect to MySQL database on the live server. I've been trying for days and am going mad!
This is what i got form my host(will change security sensitive stuff):
Your MySQL database settings Server Name: mysql-913 Server IP Address: 243.131.32.34 Database Name: zebradat Database Username: zebradatadmin Database Password: 3vex491
Can someone tell me please what my connection string should look like based on the above.
Is below correct??
<add name="ConnectionString" connectionString="Data Source=243.131.32.34;
Initial Catalog=zebradat;
User ID=zebradatadmin;
Password=3vex491;
Integrated Security=False;
User Instance=True" providerName="System.Data.SqlClient"/>
I need to name my database zebradat.mdf? Am i correct?
You probably don't want to be using System.Data.SqlClient. You should download and install a MySQL-specific .NET provider of which there are a few. Then you can get your connection string format here:
I have downloaded the connector, but how do I utilise it /"add the reference" to it? I've installed and run locally.. any links to a step by step guide as the instructions on the dev.mysql.com are too advanced for me. I need very basic noob step-by-step instructions
as I have no experience w MySQL databases.. Thank you very much in advance
Right click on references under your project. Choose the Browse tab. and then browse for the dll that you downloaded, the last time I downloaded it, its name was "MySql.Data.dll"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My Blog If you get the answer to your question, please mark it as the answer.
Thank you very much ralph! I have referenced MySql.Data.dll as per your instruction, but am wondering are any new strings suppose to appear in my web.config file (or in my assembly or...)as the result of this action?? Where can find those
classes that you mention below?
Description:
An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local
server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors>
tag should then have its "mode" attribute set to "Off".
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
1. Please tell me you did not write your password in your post :) If you did, I suggest you change your password, as hackers can get to this post easily.
2. Before you add your connection string to your Web.Config. use Use it as a string directly in the code that I sent you last. In other words instead of writing it in web.config, pass it as a parameters to the MySqlConnection.
3. Edit your Web.Config file to allow you to see errors remotely, follow the instructions on the page (setting the custom errors to off instead of
RemoteOnly)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My Blog If you get the answer to your question, please mark it as the answer.
Graphicreep
0 Points
16 Posts
Can't connect to the MySQL database online. Please help!
Apr 11, 2008 03:24 PM|LINK
Hi guys,
I'm new to ASP.NET (as you will be able to tell, i'm sure ; )
I can't connect to MySQL database on the live server. I've been trying for days and am going mad!
This is what i got form my host(will change security sensitive stuff):
Your MySQL database settings
Server Name: mysql-913
Server IP Address: 243.131.32.34
Database Name: zebradat
Database Username: zebradatadmin
Database Password: 3vex491
Can someone tell me please what my connection string should look like based on the above.
Is below correct??
<add name="ConnectionString" connectionString="Data Source=243.131.32.34;
Initial Catalog=zebradat;
User ID=zebradatadmin;
Password=3vex491;
Integrated Security=False;
User Instance=True" providerName="System.Data.SqlClient"/>
I need to name my database zebradat.mdf? Am i correct?
Your help will be much appreciated!
CodingTheWhe...
Member
186 Points
28 Posts
Re: Can't connect to the MySQL database online. Please help!
Apr 11, 2008 04:19 PM|LINK
You probably don't want to be using System.Data.SqlClient. You should download and install a MySQL-specific .NET provider of which there are a few. Then you can get your connection string format here:
http://www.connectionstrings.com/?carrier=mysql
Though most hosting providers have some option to let you view the DB connection string.
Hope this helps...
ralph.varjab...
Participant
1108 Points
207 Posts
Re: Can't connect to the MySQL database online. Please help!
Apr 11, 2008 04:44 PM|LINK
You need to go to this page
http://dev.mysql.com/downloads/#connector-net
And download MySQL Connector/Net
Then Just like you would use System.Data.SqlClient,
you will have MySql.Data.MySqlClient once you add a reference to the files downloaded above.
Then you will have a set of parallel classes similar to System.Data.SqlClient
SqlCommand = MySql.Data.MySqlClient.MySqlCommand
SqlConnection = MySql.Data.MySqlClient.MySqlConnection
And so on...
As for the format of the connection string
It is like this
private static string _connectionString = @"Persist Security Info=False;" + @"database={0};" + @"server={1};" + @"user id={2};" + @"Password={3};" + @"Port={4};";Where you fill in each value in its place using String.Format.
Hope this helps.
My Blog
If you get the answer to your question, please mark it as the answer.
Graphicreep
0 Points
16 Posts
Re: Can't connect to the MySQL database online. Please help!
Apr 14, 2008 08:25 AM|LINK
Thank you so much for your replys guys. Will try this out and let you know how I get on. Thnx again
Graphicreep
0 Points
16 Posts
Re: Can't connect to the MySQL database online. Please help!
Apr 14, 2008 04:08 PM|LINK
ralph.varjab...
Participant
1108 Points
207 Posts
Re: Can't connect to the MySQL database online. Please help!
Apr 14, 2008 04:23 PM|LINK
Right click on references under your project. Choose the Browse tab. and then browse for the dll that you downloaded, the last time I downloaded it, its name was "MySql.Data.dll"
My Blog
If you get the answer to your question, please mark it as the answer.
Graphicreep
0 Points
16 Posts
Re: Can't connect to the MySQL database online. Please help!
Apr 14, 2008 08:22 PM|LINK
Thank you very much ralph! I have referenced MySql.Data.dll as per your instruction, but am wondering are any new strings suppose to appear in my web.config file (or in my assembly or...)as the result of this action?? Where can find those classes that you mention below?
"
You need to go to this page
http://dev.mysql.com/downloads/#connector-net
And download MySQL Connector/Net
Then Just like you would use System.Data.SqlClient,
you will have MySql.Data.MySqlClient once you add a reference to the files downloaded above.
Then you will have a set of parallel classes similar to System.Data.SqlClient
SqlCommand = MySql.Data.MySqlClient.MySqlCommand
SqlConnection = MySql.Data.MySqlClient.MySqlConnection
And so on...
As for the format of the connection string
It is like this
private static string _connectionString =@"Persist Security Info=False;" +..................."
This is supppose to go into the web.config file i assume?
Can you please elaborate on this, give examples,(as I did hours of search/reading after your last reply but didn't get anywhere/am non the wiser : (
Many thanks for all your help ralph!
ralph.varjab...
Participant
1108 Points
207 Posts
Re: Can't connect to the MySQL database online. Please help!
Apr 15, 2008 09:00 AM|LINK
If you have added the reference then all you need to continue is
MySqlConnection connection = new MySqlConnection(your connection string here)
Your connection string would be
"database={0};server={1};user id={2};Password={3};Port={4};"Please fill the appropriate data instead of {0} {1}...
server is the hostname or ip
database is the MySql schema or the database name that is being used
You can omit the Port.
then try connection .Open and see if you can connect.
The rest is pretty similar to all ADO.NET operations, Adapter, DataSet, ExecuteNonQuery...
Hope this helps.
My Blog
If you get the answer to your question, please mark it as the answer.
Graphicreep
0 Points
16 Posts
Re: Can't connect to the MySQL database online. Please help!
Apr 15, 2008 10:23 AM|LINK
Thanks ralph
This is my string. This ok?
<connectionStrings><
add name="ConnectionString" MySqlConnection connection = new MySqlConnection("
database=zebradat;server=243.131.32.34;user id=zebradatadmin;Password=3vex491;") providerName="MySql.Data.MySqlClient"/></
connectionStrings>Still not able to connect am afraid.
I get the runtime error
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration>Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration>ralph.varjab...
Participant
1108 Points
207 Posts
Re: Can't connect to the MySQL database online. Please help!
Apr 15, 2008 10:45 AM|LINK
ok 3 things.
1. Please tell me you did not write your password in your post :) If you did, I suggest you change your password, as hackers can get to this post easily.
2. Before you add your connection string to your Web.Config. use Use it as a string directly in the code that I sent you last. In other words instead of writing it in web.config, pass it as a parameters to the MySqlConnection.
3. Edit your Web.Config file to allow you to see errors remotely, follow the instructions on the page (setting the custom errors to off instead of RemoteOnly)
My Blog
If you get the answer to your question, please mark it as the answer.