2 Replies - 2474 Views - Last Post: 24 January 2011 - 02:38 PM Rate Topic: -----

#1 noviceProgrammer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 04-January 11

Connect to Remote SQL Server

Posted 23 January 2011 - 11:01 PM

Quick question I can't seem to figure out.
I wrote a couple c# sql database applications.
I want to write one for customers, but if I don't have their
already installed sql server instance or even the server name on which
their database resides, how can I work with it, adding tables and data and such. I guess I could package sql with my app and run a script to configure it, but even so, how can my app connect to it if I don't have the machine name on which the customer installs it?

This post has been edited by macosxnerd101: 23 January 2011 - 11:02 PM
Reason for edit:: TItle renamed to be more descriptive


Is This A Good Question/Topic? 0
  • +

Replies To: Connect to Remote SQL Server

#2 andy_pleasants  Icon User is offline

  • D.I.C Head

Reputation: 41
  • View blog
  • Posts: 122
  • Joined: 08-July 10

Re: Connect to Remote SQL Server

Posted 24 January 2011 - 04:54 AM

Well there are many applications that use SQL Server in the way you want to use it and although I'm not sure how it works entirely, I could have an educated guess.

Most Client/Server applications (which is effectively what SQL Server is) use a kind of two tier approach. The first of which is a daemon, which runs in the background on the server and the user is completely oblivious to it. In the case of SQL Server the daemon is the bit that manages the database itself. You can view this by doing Start -> Run and typing "services.msc" you'll notice the SQL Server service running in the background. This "tier" is called the service tier (for future reference) and runs on a given port (I think maybe SQL Server runs on 3306 ??).

The second layer is the bit you see, the Application layer. In the case of SQL Server this is SQL Server Management Studio, you'll notice when you start it up, it asks for a database engine to connect to - this is the service that is running. It then displays the data from that service to the user, no data is actually stored in SQL Server Management Studio.

Now, what this means is you can have multiple SQL Server daemons (or services) running on a specific machine at any one time - and this is what I suggest that you do. Creating a new service will mean you don't have to know the machine name before hand, OK, you'd need to dynamically build it into your installer; and this is the bit I am not sure how to do.

I'm sorry I can't be any more help than this and I'll try look further into how to do this (because I am also interested) but for now I hope this can help you with your investigation.
Was This Post Helpful? 1
  • +
  • -

#3 Guest_noviceProgrammer*


Reputation:

Re: Connect to Remote SQL Server

Posted 24 January 2011 - 02:38 PM

Good points in your answer. I like the idea of creating a service, that
def. leads me in a good direction to a final solution. Thank you sir!
Was This Post Helpful? 0

Page 1 of 1