Database is not connected to my website build on ASP.Net - sql-server-2008

I got stuck in deployement of my website built using ASP.Net, C# and using sql server 2008 database. The problem is that website is working perfectly fine on localhost but it is not connecting with database when I hosted it on web, I know that the problem is in Sql server database in giving permission or something but I don't know exactly because the connection and user which I have created is exactly the same as I used while development and as soon as I deployed it on web the part which is not using database is working fine that is login page but when I enter username and password in the interface and hit login it does not go into database and pull the data, I mean it does not connect to database at all.
My question is that does it matters in accessing database from localhost and from web, Though I am still using My local computer for Coding and using the company"s database through VPN. This is first time I am deploying the website on web and I need some help, I know my way of asking question might ambiguous but please try to understand and if you have some question than please ask don't just ignore.
Many thanks in advance.

Most frequent solutions:
Enable TCP/IP protocol for sql server instance.
Enable SQL Server Browser service.
Open firewall ports.
More information:
http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/

Related

Accessing Mysql Database from a Machine to another machine using an application

So, I basically made a Windows Application using Visual Studio 2019, and used MySQL as my database to store records.
Now I want to publish that application and send it to a client or try to run it on a different machine, but i think since i have used the localhost as my database connection it wont be able to read or write data on my database from another machine.
So basically I want to know how can i host my mysql database on a machine and access that database from another machine using an application.
I am unable to find any sort of guide to do it online, if someone can guide me or give me a referrence from where I can get information and solve my issue.
You can expose your localhost to be accessed remotely, However, this is not ideal or advised. I will suggest you host your database on one of the virtual or cloud services and access it in your application.
Examples of services like https://remotemysql.com/ https://www.db4free.net/ which I advice you use for testing purpose only. You can create your database and they will give you the connection parameters to fill your connection string.
Let me know if is helpful.

How do I connect a desktop app to an hosted database

I am developing a desktop app and I want to store data in hosted database like MySQL/MongoDB. I know one solution is using webservice to manipulate db. I am wondering is there a way to connect desktop app with hosted db directly.
I am using OpenShift I know I can use port-forward to do this. But it's unpractical to open port forward every time for every PC. So is a way simply like this:
mongoose.connect('mongodb://user:pass#host:port/db');
I tried this but I got 'connect refused' or 'connect not found' errors. OpenShift doesn't allow external access to database directly because security issues, right? Then how could I do it without port-forward?
Also I read some articles about SSH, is it possible to use SSH to access db directly when desktop app is launched?
Thanks for any suggestion.
I don't think OpenShift is going to be a good fit for what you are trying to do, unless you decide to build a service layer between your desktop app and the database. It sounds like you are looking for a Database As A Service. You mentioned both MongoDB and MySQL. MongoLab is a good MongoDB DBaaS option. For other databases like MySQL, PostgreSQL and several others you could look at Amazon RDS.

Connect to MySql database through xamarin

I'm currently doing a iOS application for school to connect to school mysql database.
It should be able to connect to it through the tools on xamarin studio.
I tried a lot of different coding to connect the database, but was unable to do so.
Is there any tutorial or example code to let me learn on how to do it ?
Thanks for any help!
Do not connect directly to a database from a mobile app. Doing this requires exposing your database server directly to the web, which is a horrible security risk. The better approach is to use a web services layer to broker the interaction between your client and your server.
http://docs.xamarin.com/guides/cross-platform/application_fundamentals/web_services/
While people are right and the best way to connect to a database is to use a web service there are some times you want to connect directly and ways to make the connection more secure (ip restrictions on the mysql server).
Here is a plugin with code examples on how to do it:
https://components.xamarin.com/view/mysql-plugin
Be sure to pay attention to the first forum question on errors and how to resolve. You need to include a reference to system.data, I18N, I18N.West in your project and also make a call to the constructor for I18N somewhere in your code.
new I18N.West.CP1250();

JustHost Cpanel - MySQL username/password access remotely

Not sure if this is the right forum for me to ask this question.
But I'm wondering does anyone having difficult using JustHost as web hosting provider in establishing remote access to their mysql database server environment?
What happened recently was that I'm trying to use mySQL ODBC driver connector via MS access to access their mysql database.
Originally I know what my username/password is and JustHost(well.. at least that's what I think they normally do) is set this similar setup for all other CPanel access such as your FTP, email, billing info, etc, etc.
Thus I tried using my username/password to logon into the mysql database via MS ACCESS's odbc connector. But I kept on being rejected to log in.
I started whether the password I used to log on my CPanel services would be different that the one used to access mysql via PHPAdmin window. Thus with that in mind, I forwarded the query to Justhost helpdeskteam.
Unfortunately they don't have a clue about this.
Thus that's what brought me here in this forum, begging this question - does anybody know what's the appropriate approach in remotely connecting mysql database environment via a web hosting provider such as Justhost.com?
Sorry for the elongated story.
Thought it would help to state the meaningfulness of my supposedly-trivial problem.
Log in to your JustHost account and scroll down to Remote MySQL. You need to add the IP address(es) of the remote server(s) to the list of Access Hosts.

Accessing MySQL Database from my VB.NET 2008 Project

I developed a project in VB.NET
In this project I want to use data from MySQL that is resides in my WEB Server.
I can communicate with the MySQL server of my localhost but can not communicate with the WEB Server.
In my CPanel I added Host from the Remote Database Access
But I can't communicate with WEB MySQL Server.
Please help me.
The first step is to try to connect to the web mysql with MySql Query Browser - that will tell you if the database is open for remote connections ( I assume it would fail)
I guess you have already checked it, but make sure you use the correct ip
EDIT:
As Björn said, your vb code is ok, so the problem is with the connection to the db.
Unfortunately that would be caused by many many reasons.
Are you sure you use a real IP from the host (and use it in the mysql settings)?
Are you sure you entered the correct remote host in the mysql settigns?
Are you sure you have correct connection string in the vb code?
Since your post indicates you can access the DB on your localhost, it doesn't seem to be an issue with the way you're connecting to the DB from your application (.NET-Connector?).
What does the external MySQL-Server say? Access denied? Or can't you reach it from the pc where your application is hosted (aka maybe a firewall regulation, other network etc.)?