SQL Azure connection string speed (IP or domain) - sql

Until now we always use an IP address in our connection string to the SQL. This way we think it will be faster because the user doesn't need to find the IP of the domain.
Now we are trying Microsoft Azure and we see that they use a domain name in the connection string.
Will be slower? sometimes we know it takes 100-400 milliseconds to resolve a domain name to an IP address, do we spend this time every reload of the page?

You need to access SQL Azure by the given server name, as you're connecting to a massive-scale system, not a single computer. Regarding delay on page load: I don't know how you architected your solution, but reloading a web page does not equate to re-establishing a database connection from web app to database.

The DNS resolution will be cached - it doesn't have to do a new look up each time. You can prove this by using resolving a DNS entry programatically via System.Net.Dns.GetHostAddresses() on a test page.
Edit: It will be cached by the calling server(s).

Related

Domain Not loading in 3g or LTE but works perfectly in Wifi

I have recently finished my website and uploaded code to server. It is working perfectly when connected to Wi-fi or broadband connection.
But When i am connecting the site using 3G or LTE it's showing some default page. Exact domain is not loading.
Still not able to understand why it's happening.
My Domain name: http://www.jockdrive.com
Please help me with your suggestions.
There might be cached data stored on the server of the Interner Service provider. Normally, ISPs clear cached data every 24-48 hours (in rare cases 72). This is called propagation.
If you want to see an up-to-date and uncached version of your website, check it via proxy server. Here is the link: https://kproxy.com/
;QUESTION
www.jockdrive.com. IN AAAA
;ANSWER
www.jockdrive.com. 3600 IN AAAA 2607:f1c0:1000:80f9:71ce:7028:7b2e:b009
Your domain name is probably configured with wrong IPv6 address, and I guess cellular operators are using that as default when available. You can try deleting that record (or check with your hosting provider if they can provide the correct one) and see if it helps.

How to check if DynDNS is working

Newbie programmer here. I'm building an app for an API that requires an IP address for authentication. Basically, users have to send the API management their IPs and then each time a computer makes a request to their server, it verifies whether it's coming from a registered IP.
Since I work in a number of different places and thus end up with different IPs, I thought it would be easiest to use DynDNS to establish a URL that points to whatever my current IP is and then send that URL to the API management. So my first question is if this approach would in fact work?
Secondly, assuming this would work, I set up ben.dynalias.com and downloaded the DynDNS Updater client. It appears to be working: the updater says status: OK and displays my current IP. However, when I navigate to the URL (ben.dynalias.com) there's no response. Should this be the case? How can I tell if it's working?
I don't see any reason it shouldn't work as long as your updaters aren't overwriting each other by running at the same time automatically from different locations.
You can ping ben.dynalias.com and see if your current ip matches.
I just hosted ben.dynalias.com and it gave me your IP.
Since there is no web server running on that IP, then your browser will not be able to show you a page result.
You can use http://www.kloth.net/services/nslookup.php
to check and see if you get the correct IP from a host lookup.
Depending on how often your IP changes this might not be a great solution as the DNS will cache your hostname and will not try and resolve it again until the TTL expires normally minimum 1 hour.
whether the API management accepts a hostname instead of an IP address is a question only they can answer. Some will, many won't as it's "easier" to hijack a domain name than to hijack an ip address.
trying to browse to you-address.dynalias.com that points to your own public address rarely works, even if you opened up the right ports because your router will be highly confused. The best way to test such a setup is by using a phone or tablet with 3g/GPRS internet - of course after you set up port forwarding in the router to point the appropriate port to your computer.

Cocoa server with user friendly automatic port forwarding or external ip lookup

I am coding a mac app, which will be a server that serve files to each user's mobile device.
The issues with this of course are getting the actual ip/port of the server host, as it will usually be inside of a home network. If the ip/port changes, its no big as i plan to send that info to a middle-man-server first, and have my mobile app get the info from there.
I have tried upnp with https://code.google.com/p/tcmportmapper/ but even though I know my router supports upnp, the library does not work as intended.
I even tried running a TURN server on my amazon ec2 instance, but i had a very hard time figuring how what message to communicate with it to get the info i need.
I've been since last night experimenting with google's libjingle, but am having a hard time even getting the provided ios example to run.
Any advice on getting this seemingly difficult task accomplished?
The port of your app will not change. The IP change could be handled by posting your servers IP to a web service every hour or whatever time period you want.
Server should run a URL http://your-web-service.com/serverip.php?ip=your-updated-ip and then have your serverip.php handle the rest (put it into a mySQL db or something)
When your client start it should ask your site for the IP and then connect to your server with that.
This is a pretty common way of handling this type of things.

Connecting to SQL Server

I have successfully executed my SQL script on Microsoft SQL Server 2008 R2. Since I am a novice at this software, I would like to know how do I connect this database with my android application? Any help would be appreciated. Previously, I was making use of MySQL on XAMPP and hosting the database using my local machine. I made use of services being provided by http://www.noip.com to host the database since I do not have a static ip address.
Thanks in advance.
Your client will have a connection string. It will usually look like one of the examples here:
http://www.connectionstrings.com/sql-server-2008
You'll probably use the "IP Address" example. From the link above:
Connect via an IP address
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;
User ID=myUsername;Password=myPassword;
You're trying to use http://www.noip.com to deal with the fact you don't have a static IP address on your home network.
I would table this part of the problem for the time being. Go to your router and find your "external IP address"
You'll have to setup some port forwarding on your local network. I'm assuming (since you didn't give any detail) that you have a cable-modem at home and a wireless router. Your router will have to be configured to handle port forwarding so that when a request comes into 55.555.555.55 (your "external ip").......it will be forwarded to your internal Sql server (like 192.168.1.33). And you'll have to know the port. "1433" is the normal port, but can be changed.
So again, any requests coming into your cable-modem and router to "55.555.555.55:1433" will have to be forwarded to your internal IP and port "192.168.1.33:1433".
Your local sql server may have firewall rules that you need to alter to open up "192.168.1.33:1433" to your router.
If you get all that working, you'll have to wire up http://www.noip.com, which I am assuming gives you a static IP address and will link up your "55.555.555.55" to something permanent, with the caveat that when your "55.555.555.55" changes to "55.555.333.44", it'll handle the mapping for you.
So if noip gives you an IP of "777.77.77.7777" (which maps to "55.555.555.55" or "55.555.333.44" or whatever IP your internet provider gives you), you'll change your connection string to be "777.77.77.7777"
That's alot of drama.
But if you want to tackle it, there are some helper hints.
At the end of the day, your client app will have a connection string with an IP address and a Port Number in it, and that client will have to be able to reach your sql server.....through all the voodoo channels.
Good luck.
I would get this working first:
Data Source=55.555.555.55,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;
User ID=myUsername;Password=myPassword;
And then work in the noip.com part later. So eventually your connection string will become:
Data Source=777.77.77.7777,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;
User ID=myUsername;Password=myPassword;

Dynamic DNS on your own server

I have a server in at a hoster (which has a static IP) and want to run a server at home too and don't want to buy the dyndns package from dyndns.com
I would either like to find a program that does this without costing money and using my own server and domain so I can have myclient.domain.com or I would like to write this myself. Would I be able to do that with a custom apache conf?
EDIT:
I have 1 Server with a static ip and I want to run a server at home (dynamic IP) I want to use the server with the static ip to run as the dyndns managing server
I use zoneedit.com for my DNS servers, and they have a free dynamic service that works fine for my home box. (On the other hand, my home box changes IP about twice a year, so it's not like I stress it.)
On my home box, I have a script that polls a tiny little cgi on my colo box to return what my current IP is (because I can't get it from the router), and if it's changed, it does a "curl" to update my zoneedit settings. When I get home, I'll try to remember to post the script.
Per your revisions: Ah, then you can theoretically do that, yes. (As noted elsewhere, apache.conf is irrelevant.) Your hosted server needs to be the nameserver of record for your dynamic DNS; you should probably use a subdomain. This would be a record in your main domain's zone file of IN NS server.ip.number.here. Then you configure a DNS server on your hosted server for the dynamic namespace; you'll have to get deep into the configuration to set up the records so that they advise client nameservers not to cache them, or to cache them only very briefly. Then you write some sort of systemry where the home machine, when a connection is established, talks to the hosted server and tells it to change the DNS for the dynamic hostname to point to its currently assigned IP.
You cannot do it with a custom Apache conf. Apache handles web serving, not DNS.
Maybe I´m wrong but I think what you want is:
create a dynamic host in a free DNS service, like dyndns.org (Or you can even manager a entire domain using editdns.com which has dynamic dns also). For example: server-at-home.dyndns.org.
Create a static IP host for the desired address (ex. www2) pointing to the same IP address of the www server.
Create a virtual host in the httpd.conf in the static ip server and put a reverseproxy using the dynamic host create on item 1.
P.S.: You said that the main goal is to void to buy for this service but i use dyndns.com and i dont pay for it. And i have 4 hosts in my account.
I have a server at home with a Static IP address, and I do exactly what you are looking to do with a free dyndns account. I just have to renew it every month or two - they send me an email and I just click the link to let them know I'm still here and alive.
I am not exactly sure, but it sounds like you want to redirect to your "server" at your house from your webserver at the hosted site?
You will need to periodically send some notification to your static IP server to let it know your dynamic ip.
You can do this is some cron/scheduled job - just create a redirect html page every day and ftp it (automagically) to your static ip host.
There are probably other ways to do this. But that should work.