I am a programmer enthusiast who recently made his first C# and an Android Studio client that uses an “Microsoft SQL Server Management Studio v18.8” database with multiple tables.
Before doing this I had no knowing in SQL programming. My goal is to give the C# client to multiple users and with the Android Studio to verify a final table instruction ( Everything works fine if the devices are in the same network area. example. C# and Android app connected on the same Wi-Fi )
If I switch off the wi-fi on my cellphone and connect it to mobile network I cannot access the database anymore. Upon searching for more information I found out that I need to configure my router for IP-Forwarding with the PORT which is configured in the SQL Server Configuration Manager. ( I edited the exception rules in Firewall setting to allow connections for that port ) Since I am new, my questions are:
Is IP-Forwarding a viable solution for accessing remotely over the internet? Upon searching I understood that it isn’t and my confusion is “How does somebody else access an SQL database remotely ( over the internet ) ?”
Moreover, is accessing remotely over the internet an SQL db viable? If not, what would be the correct approach for a client to INSERT/SELECT something in a SQL server which is located on another network that has an open connection with the internet?
On both clients the string connection is made by giving the server’s IP / PORT, database and Login Credentials. Is there a way to hard code the Password Credential? So that it won’t be a string variable, vulnerable to hacking?
For me is a challenge and I find it fascinating how fun is to manipulate the SQL data and the fact that it works is super impressive.
My 4th question will be off topic, but learning/writing the programs I start thinking: Is an API and an SQL database related somehow? Or at least they work on the same principle?( I have no deep knowledge of what an API is, just basic understanding ) Is this what back-end programming means?
Related
I am currently about to undergo a programming project that requires me to have access of data on a table in a MySQL schema that is on my desktop. I am trying to connect to this schema from visual studio on my laptop.
What I am trying to do is link the two so I will be able to access the data on the table on the MySQL schema. Is this possible over two computers? And if the link is made, will I be able to work with the database while I am at school? If it would work how would I do it?
I am currently a COMPLETE novice at MySQL, I only started to learn it last night. However I am ok at C# on visual studio.
It's as easy as connecting it in your laptop.all you need to do is allow port access in the firewall.in you connection string add ip address or computer name.of the host server as your host.
Something like this.
"Datasource='192.168.1.1';port ='3306'; database='mydb';username='root';password='123'";
I've just installed MySQL with phpmyadmin on my VPS via ssh protocol, and I've created root account with all privileges. I figured out how to connect with my databases via C# using MySQL 5.5v. for .Net 2.0 - the only version acceptable for Unity3D. And I have a few questions about it. I don't know is it right to connect to database on client side with root account, i mean something like that: Server=***;Database=Users;Uid=root;Pwd=***;
and then type query: SELECT * FROM Users where .... i think its unsafe way. How can I connect do it in more safety way? Without giving Password to Root account in C# code, maybe create another account without modify permissions?
It's not a good idea to connect to the database from the client(Unity), if this app will be released anywhere on the internet. The way to do this to use POST or GET method with the help of the WWW class, to send and receive information your server.
Your server should be coded with php,perl, c++ or whatever language you prefer.It will read data you send from Unity, then retrieve information from database and send it back to the client(Unity). Again, the whole database connection should be done on the server not on the client side.
One exception to this is when your app will only be used in your company office. As long as it will be made available for others to download, it is not secure if you hard-code the login information or even allow direct connect to the database from the client side. There are many examples on Unity wiki website.
I have a bunch of small desktop applications for which I have a simple database for keeping user data (who uses which app and in which version) etc.
I want the apps to connect to Azure SQL server and update database record when they're started. My apps have the ADO.NET connection string hardcoded in them.
It works fine from my home network and my company guest network - however, the corporate network has got some of the ports disabled, and that apparently includes port 1433. As per Microsoft troubleshooting guide, I tried telnet and failed.
C:\Users\xxx>telnet 65.55.74.144 1433
Connecting To 65.55.74.144...Could not open connection to the host, on port 143
: Connect failed
I cannot connect neither via my applications, nor by SQL Server explorer in Visual Studio.
So, the question is - how can I get around this problem? It is highly doubtful that corporate IT will unlock a port just because I ask, besides I want to keep it as simple, low profile and independent as possible. Or maybe my approach is incorrect from the very beginning and I should do stuff differently?
Cheers
Bartek
You can't.
Make your desktop applications talk to web services instead, over HTTP/HTTPS. Among other things this will also allow a more controlled access (right now anyone can connect to your database and modify the data, since your access credentials are publicly shared with your app).
A side effect of using we services is that 80/443 are almost always opened in all corp firewalls.
I'm not sure if this is the right place for this question, but here goes......I have a website that was developed in PHP using MYSQL. Now, I am wanting to write an application in Visual C# which accesses the MYSQL database, and returns data from that database to the application. I attempted this, and received the error "(xx.xxx.xxx.xx) is not allowed to connect to this MYSQL server". After some research, I found that there was a way to turn this off on the server by IP address. However, this application would eventually be distributed to other people and PC's, so I don't think this is a permanent solution. I think I could open the MYSQL database to the world, but I'm hoping for some way that I can connect to MYSQL and tell the server that I am coming from the hello world application only. Does anyone know if this is possible from Visual C# and MYSQL, or know of a secure way to connect to a remote website MYSQL database using an application that can have a dynamic IP address?
Thanks in advance!
Ramhound is right in that you need to reconfigure your server if you want to do anything like this, but if you want to connect to the server directly from the client applications, your client would need to have the password for your Mysql which is not ideal..
Instead you should set up a webservice on your database server, and use that to sent/receive data to and from the clients.
I am pretty new to SQL and I'm stuck on something which is probably a few clicks away.
The program I am building will store the data in the database created on the management studio. Everything works fine on a test application. Now the question is: how should I connect to the database if I want to open the program from another computer? I tried copying the test project on a friend's computer but it cannot find the database as I suppose is obvious because the db is stored on my pc.
i know hundreds of questions like this exist around google but I'm sick of looking at forums reading complicated stuff. any help will be really appreciated.
thanks.
In the database connection settings or script you propably have database server set to 'localhost'
Try setting this to the computer network IP if the other computer is inside the same network.
To connect to it from outside the network (over the internet) You need set the database server setting to you external IP and you have to port-forward (NAT) the SQL server port to your computer.
If you can tell us what database software you are using for the Database I can tell you what port to forward, for more help with forwarding you should ask on serverfault.com and also provide your router/firwall make and model
It depends (at least partly) on how you're connecting to the database in the first place. Normally, you'll have some sort of connection string that tells what computer to connect to. It'll be set to the local computer by default, but changing it to something else is normally just a matter of editing that machine name into the string.
If you're connecting via ODBC, the program will just specify an ODBC connection, and the ODBC connection will specify the machine to connect to. You can use the "Data Sources (ODBC)" control panel to edit these (depending on the version of Windows you're using, it may be in the "Administrative Tools" folder instead of showing up directly in the control panel).
when you want to connect to a sql server over the network there are a few things you should know/check:
is your connection string correct (not localhost)
does the remote sql server accept tcp/ip connections
does the firewall of the remote compture allow the connection
Is the sqlbrowser running on the remote computer (if not you need to specify the port in your connection string.
To make sure this al works the best thing you can do is try to connect from the new pc to the remote database using sql management studio or if you don't want to install the ssms you can try to create an odbc profile that connects to the remote pc. By doing this you can determine if the problem is with the database itself or with your application.