.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

MySQL: can't connect from remote client code

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net

I have a MySQL data at a web hotel. I can connect to the database from my web application hosted at the hotel . But trying to connect from a client application running on my PC fails using the same ConnetionString. The error is: Unable to connect to any of the specified MySQL hosts

In fact the method below (the method is protected in the web application) fails in my client application but works in my web application.

private void button8_Click(object sender, EventArgs e)
string MyConString = "server=db.MYSITE.dk;user;" +
"pwd=PASSWORD;database=DATABASE" ;

label1.Text = label1.Text + MyConString;

MySqlConnection connection = new MySqlConnection();
connection.ConnectionString = MyConString;

catch (MySqlException ex)
label7.Text = ex.Message;


I just tried to download WorkBench 5.2 and HeidiSQL, both connects to the database from my PC when supplying server and password information.

Any help that will allow me to connect to the database from my client application I much appreciated. I use connector 6.2.4



View Complete Post

More Related Resource Links

WCF Client (netTcpBinding) does not connect to remote DNS on Vista and Windows 7

Hi, WCF Client (netTcpBinding) does not connect to remote DNS on Vista and Windows 7. With other OS like XP and Windows 2003, client connects to remote DNS properly. I got the following exception. Same client works in Vista and Windows 7 if service is available in local network. Following are the exceptions: <Exception> <ExceptionType>System.ServiceModel.EndpointNotFoundException, System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> <Message>No DNS entries exist for host icelive.theice.com.</Message> <StackTrace> at System.ServiceModel.Channels.DnsCache.Resolve(String hostName) at System.ServiceModel.Channels.SocketConnectionInitiator.GetIPAddresses(Uri uri) at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout) at System.ServiceModel.Channels.BufferedConnectionInitiator.Connect(Uri uri, TimeSpan timeout) at System.ServiceModel.Channels.TracingConnectionInitiator.Connect(Uri uri, TimeSpan timeout) at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout) at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.Comm

problem to connect mysql remote db


hi friends,

i am getting problem to connect to my remote sqlserver database..

i have connection string as follows


add name="ConnStr" connectionString="DRIVER={MySQL ODBC 3.51 Driver};SERVER=;PORT=3306;DATABASE=mydb name;UID=username;PASSWORD=mypasswd;OPTION=3;" />


i am giving all information correctly..

how to connect to Remote mySql Server?


Hi there,

i have installed mysql server on linux on remote server.

now i want to connect it from my local mysql server which is on windows.

whenever i connect to mysql server i get the error 

Error No: 1130

Host '' is not allowed to connect to this mysql server.

this= my remote server which is on linux...

please help how to connect it?

Error No. 1130
Host '' is not allowed to connect to this MySQL server

Return of the Rich Client: Code Access Security and Distribution Features in .NET Enhance Client-Sid


Rich clients employ many of the features and conveniences of the operating system they run on, and the list of these features has been growing since the dawn of the PC. But as apps have migrated to the Web, the trend towards increasing client-side functionality has ground to a virtual halt. There are several reasons for this; chief among them are security and deployment problems. But that's all about to change. With the .NET Framework, you can participate in building the distributable rich client of the future. In this article, the author enumerates the pertinent features of .NET that will allow you to build safe, easily deployable controls. The features discussed include managed code, code access security, versioning control, Windows Forms classes, and isolation.

Jason Clark

MSDN Magazine June 2002

C# and the Web: Writing a Web Client Application with Managed Code in the Microsoft .NET Framework


When the author wanted to build a middleware Web client to connect to other applications over the Internet, he realized that the XMLHttpRequest COM object was not sufficient for his purposes. In order to build a Web client using managed code, the author had to use the HTTPWebRequest and HTTPWebResponse classes provided by the Microsoft .NET framework. These classes are used in the sample project as a substitute for the less powerful XMLHttpRequest COM object, allowing the author to build a full-featured Web client. They also take advantage of all the benefits that the CLR and managed code have to offer.

Avi Ben-Menahem

MSDN Magazine September 2001

need help about "Unable to connect to remote server." using HttpWebRequest


Hello friends 
I am creating an application where I want to store an html page from one of my websites into another web site. 
For the same purpose I am taking the url of the html pages 
for example if I want to copy this page "http://mydomain.com/html/page1.html" then i take this url from a text box which user enters.

Unablke to logon on Sharepoint 2007 front-end with remote IE8 client


We are having problems to logon on the sharepoint front-end server from a client pc, within the same network. The Sharepoint 2007 servers are running on WIndows 2008 Datacenter (2 Front ends, 1 index, 1 SQL database 2008 server).

When we try to logon the server creates an event with id 4625, status: 6d, sub-status: 6a. When we use the same account from IE 8.0 on one of the servers within the farm, then it works.

The same configuration is installed within another environment where evereything works.

Is there somebody that solved this issue??

Sign outgoing body from client with custom endpoing behavior defined in code

I'm trying to sign (and sign only) the body of every outgoing message that uses this custom endpoint behavior.  When I first created this it was for signing a custom SOAP header.  We are moving away from that and going to just sign the body.  We have some applications that have 10+ web service references.  We don't want to touch the reference.cs for anything.  Below is the code I had before for signing the custom soap header.  I'm trying to modify it to just sign the body.  My modified code is below, and the error I get. Private Class CustomHeaderBehavior Implements ServiceModel.Description.IEndpointBehavior Public Sub New() End Sub Private Sub AddBindingParameters( _ ByVal endpoint As ServiceModel.Description.ServiceEndpoint, _ ByVal bindingParameters As ServiceModel.Channels.BindingParameterCollection) _ Implements ServiceModel.Description.IEndpointBehavior.AddBindingParameters Dim body As New Xml.XmlQualifiedName("Body", "http://schemas.xmlsoap.org/soap/envelope/") Dim BodyMsgPartSpec As New ServiceModel.Security.MessagePartSpecification() BodyMsgPartSpec.IsBodyIncluded = True Dim requirements As ServiceModel.Security.ChannelProtectionRequirements = bindingParameters.Remove(Of ServiceModel.Security.ChannelProtectionRequirements)() requirements

Unable to connect to SQL Server 2005 remotly, all client protocols are blank

I have an installation of SQL 2005 and had issues connecting remotly. Looking at the client protocolols, they are all blank. I can see that TCPIP, Named Pipes, VIA, etc. are 'enabled', but where the words 'TCPIP', 'Names Pipes', etc. should be, it's just blank. I tried to install SQL 2008R hoping the Client Protocols would be corrected during the installaion, but they were not. I'm assuming the issue with the Client Protocols not showing up is a symptom of the problem. Does anyone have any ideas? Thanks!

connect client certificate to an account in a membership database

Hello I have created a web service that authenticates with username and password, works fine.Basically this one, http://msdn.microsoft.com/en-us/library/ff649647.aspxNow I also want to connect to this web service using client certificates, works finehttp://msdn.microsoft.com/en-us/library/cc948997.aspx But I would like to when authenticated via client certificates, connect that certificate to a user in the membership database.So that I can use Roles.IsUserInRole(...) and such.I thought that, well if I implement a Custom certificate Validatorhttp://msdn.microsoft.com/en-us/library/ms733806.aspxthen I could check for example subject and map that against a created username in the membership database.But in the class X509CertificateValidatorpublic override void Validate(X509Certificate2 certificate)I don't have the same ability as when the user is authenticatedlike  void OnAuthenticateRequest(object source, EventArgs eventArgs)HttpApplication app = (HttpApplication)source;Basically how can I do this app.Context.User = new GenericPrincipal(new GenericIdentity(username, "Membership Provider"),roles);withinpublic override void Validate(X509Certificate2 certificate)and if that is not possible, can this be solved differently?Bottom line, how do I connect a client certificate to a user account in the membership database. Is there a MSDN article

Getting client information from X.509 certificate in C# code

I have a WCF service which accepts X.509 certificate signed incoming messages. As per my understanding the client will send the message with signature encrypted using his private key and web services will decrypt the signature with client's public key. This ensures that the sender of the message is holder of the private key and that he is certified by the server trusted CA as "He is what he claims to be". It's being a highly secure application I need to give access to only certain clients regardless of whether they are trusted or not. (This is to take care of good turned bad scenario :-)) How do I achieve this? Is there any way to get the client information as subject name etc from his certificate in C# code? Is there any example of this usage? Thanks in advance,Jeet.    

Can I invoke a client side script from server side code

Hi is it possible to involk a client side script from the server side code without any interaction from the client side?Such as a popup or alert box?I know I can code this with the page load or the click event, I would like to call the alert from within my serverside code and trigger the action from there.Thanks

Calling Serverside PageMethod function from an external page Client Side Code ?

there is many examples on the net about this issue .like this :http://sappidireddy.wordpress.com/2008/03/31/how-to-call-server-side-function-from-client-side-code-using-pagemethods-in-aspnet-ajax/But all javascript codes are in same aspx file including codebehind WebMethodsI wantto call a pagemethod from a js which is in another page.something like this : (javascript code but not in same aspx)PageMethods("www.externalpage.com").GetContactName(ctrl.value, CallSuccess, CallFailed, dest)).or calling WebMethods from javascript must only be defined in codebehind with linked aspx fileonly avaible in same aspx ?cant I call a Webmethod in a.aspx from a javascript in b.aspx ?any clue ?thanks.

convert client vbscript code to server side

Hi There, we have some .htm pages with client side vbscript,the code is pasted below, we want to get this page run on the server side so that we can access this from a URL, can you please advice how convert this code to be able to run on the server side. Client side code: <HTML><HEAD><TITLE>Select Module</TITLE> <SCRIPT LANGUAGE="VBScript" ><!--     Option Explicit        Dim College    Dim Modules    Dim ModulesArr    Dim counter    Dim MyModules         Set College = Top.App.ActiveCollege    Set Modules = College.Modules     'Sorts the ModulesArr Array by module name.    Sub SortModules(StartPosition, EndPosition)        Dim I, J        Dim CurrName, CurrIndex        For I = StartPosition to EndPosition            J = I            CurrIndex = ModulesArr(J, 0)            CurrName = ModulesArr(J, 1)             'while Mod

WCF client code Generation

Hi, I am new to WCF programming. I am confused in creating client code. Will it be created automatically when I add Service Reference or I will have to create it using Svcutil.exe or Both things: I will have to add service reference and then create client code using Svcutil.exe Kindly confirm.Amit Lohakare

How can a C# client app list the authorized CA certificates sent by a web server over an SSL connect

Hello, I am currently writting a C# client application that must access a web page over SSL authentication, having the Client authentication required. I know that the SSL protocol defines that the web server sends the list of authorized Certification Authority that the web server can trust for the SLL session to be successful. My client application has to filter a X509Certificate collection in order to popup a Certificate Selection dialog box to the user. I fould like to only display certificates that the web server would accept. I already have filtered the certificates according to the "Client Authentication" Enhanced Key Usage and other stuf. I know how to set the client certificate to be used for SLL conection, but I just would like to access the CA cert list provided by the server.   Could someone help me ? Thanks a lot !
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend