0

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:

  1. 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 ) ?”
  2. 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?
  3. 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?

enter image description here

i33SoDA
  • 25
  • 6
  • You have a lot of quite reasonable questions, but you need to split your catchall question into several questions with exact problem and ask them on different sites of StackExchange. You can check this [What topics can I ask about here?](https://stackoverflow.com/help/on-topic) and this: [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) – astentx Dec 27 '20 at 20:28
  • 3
    Remotely accessing a SQL database directly from Android is a big no-no, see https://stackoverflow.com/questions/26470117/can-we-connect-remote-mysql-database-in-android-using-jdbc for example. – Luke Woodward Dec 27 '20 at 20:28
  • Client app (deskop, mobile or even web) === vulnerable, so **never** direct connections to a database or any other sensitive resource. You need an API to handle the requests, and you need to host that API somewhere. Also, databases should ideally **NOT** be exposed to the internet – Camilo Terevinto Dec 27 '20 at 20:31
  • There are public and private networks. You can only communicate between machines that both have public IP addresses (Internet) or between machines on the same private network. You have an Internet Provider where you have one machine with a Public IP (Internet) which is your gateway (firewall) and then machines on your private network). Port Forwarding will allow you to run an application on your gateway that will forward messages from your private network to the internet. It is a kind of a port forwarding but not usually referred to as port forwarding. – jdweng Dec 27 '20 at 22:12
  • Thank you all for the answer. You are all amazing. ^_^ – i33SoDA Dec 28 '20 at 16:48

0 Answers0