how to connect to another sql server database(server pc) in local area network - sql-server-2005

i m creating an application, inwhich client has to acces a database stored in a remote location connnected through a live ip. how can i connect simply with a database server placed in LAN. both using sql server 2005 express edition. please refer me or help me on this

Set in your connection string IP address of remote server.
E.g.
"Data source=192.168.0.13; Database=MyDb;User ID=my_user;password=12345"
where 192.168.0.13 is your remote server IP and MyDb is your database name.

Also, make sure to configure your SQL Server Express to allow remote connections! Those are disabled by default after installation.
Check out the SQL Server Surface Configuration tool (if I'm not mistaken) to configure these settings.
Marc

This not about programming. You have forward the port which Sql Server uses on modem.

Related

How to connect to sql server database via LAN

want to connect to a database on another PC connected via LAN. I am able to use the sql server db with string like C:\Users... but i cannot connect using string like (\\Server\c\user...) I tried to move the db file to My Documents, still i get this error.
I get the following error message: An attempt to attach an auto-names database for file (\\SERVER\Users\Jeswills\Documents\TBSDB.mdf) failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share
I hope i asked the question correctly
As database does not support the '\SERVER\c...' parameters, i had to attach the database, after enabling TCP/IP and SQL Browser, i had to create a login through security and add it to the attached database file because authentication must be SQL not windows. And i also gave read/write privileges to the account. Then on the child system, i confirmed connection to the account through SSMS with the login connecting to SERVER (which is the remote computer's name).
Note: you must be able to ping the remote systems and SQL Server Express R2 installed. I tried with SQL Server Express but did not get a head way. www.connectionstrings.com/sql-server-2008 for more connection string
Then i used this connection string to connect remotely, making integrated security and user instance = false unlike if i were connecting locally.
Data Source=SERVER\SQLEXPRESS,1433;Database=DATABASEFILE.MDF;Integrated Security=False;Network Library=dbmssocn;Connect Timeout=30;User Instance=False;user='USERNAME';password='PASSWORD'
Not sure what specifically you’re trying to do here but I guess it’s one of these two.
Option 1
Attach database stored on remote shared drive to a local SQL Server
Note that this is only possible starting in SQL Server 2008 R2. If you’re running SQL Server 2008 this is not an option.
Check this for more details
http://blogs.msdn.com/b/varund/archive/2010/09/02/create-a-sql-server-database-on-a-network-shared-drive.aspx
Option 2
Connect to remote SQL Server instance from local computer
If that database is already attached to SQL Server instance that runs on the same machine then it’s much better to just connect to that instance from SSMS than trying to attach database from remote storage.
To do this you need to enable TCP/IP protocol in SQL Server Configuration Manager. It’s under SQL Server Network configuration node. Make sure you enable TCP/IP and also set enable the IP address for listening (this is under TCP/IP properties).
Apart from this you’ll want to enable remote connections on your remote instance. This is done from SSMS -> instance properties -> Connection tab
When this is done you should be able to connect to remote instance from local SSMS by typing in IPaddress/instance name. For example 192.168.0.125/{instance_name} or only IP address if this is default instance.

Connecting to DB through internet

I have SQL Server DB in my computer, attached to my server. I want to access it through internet.
Please advise what will be the connection string etc. for it.
is your SQL Server accessible via your local management studio, if yes then you'll use same credentials for your connectionstring to connect to remote server. else you have to configure DNS or firewall options to allow this kind of connection.

How to connect database over local area network SQL Server 2008

I want to connect my db on SQL Server 2008 over local area network I want to put it on one computer on the LAN so any computer on the network can access it what should I do please give me correct steps
In a Client-Server scenario, you will have the SQL Server installed on your server machine.
Clients will be the computers accessing that SQL Server using a client software (can be SQL Server Management Studio, web/forms application, Excel worksheet, etc).
Each of the client will provide you a way of making a connection to the SQL Server Instance running on the server. From server you will need IP Address or Servername along with SQL Server Instance name. They both combined form host name.
Data Source = ServerName\InstanceName
Note: Instance name not required for default instance.
User name: You need to add user from domain or a sql server authenticated user under security tab (SSMS) on the SQL Server.
Password: Corresponding password.
Note: Once you add a user to SQL Server Instance, do not forget to attach the user to databases you want the user to access and provide appropriate role(s).
Install SQL Server 2008 on one machine on your LAN (let's call it SQLServer)
Connect that machine to the LAN (network cable)
You're done.
Now, all other computers can connect to that SQL Server machine by its name in the connection string - in .NET, that would look like:
server=SQLServer;database=YourDatabase;User ID=YourUser;Pwd=top$Secret

sql server 2000 error, error trying to connect to sql server 2005

i am connecting to sql server 2000 on a remote computer with a dotnet application, but when i try to open the connection it gives the following error:
When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections
What is this?
It means that the remote SQL server is configured to not allow remote connections.
From this forum discussion:
Make sure SQL SERVER is up and the instance you try to connect is running.
Your system Firewall should not block SQL Server port.
Go to Computer Management >> Service and Application >> SQL Server 2005 Configuration >> Network Configuration Enable TCP/IP protocol. Make sure that SQL SERVER port is by Default 1433.
Now follow this KB Article of MSDN depending on your server.
Are you sure you're connecting to a sql server 2000 instance?
Possibly it's been upgraded to 2005?
Try following the procedure here: http://support.microsoft.com/kb/914277 to allow remote connections.
By default, as a security feature, SQL Server 2005 does not enable connections from other machines on the network.
Verify that your SQL Server and its databases are suitably secured (for example, have proper user accounts and passwords, etc.). Once you are satisfied, go to Start, Program Files, Microsoft SQL Server 2005, Configuration Tools, SQL Server Surface Area Configuration. Look for Database Engine, Remote Connections and change the setting to allow remote connections.

How to connect to SQL server through IP

I have a remote server that has win2003 installed
I can connect to the machine using remote desktop and am succesfully hosting a web app on the server
I need to connect to the SQL server on that machine using a sql compare tool that I have.
What are the steps that I need to take to be able to connect to the SQL server given that all I have is the IP address to the machine and admin login credentials
if you are trying to remotely connect to sql server using ssms or another client on a different machine, you need to do the following:
open up sqlservr on server firewall
open up sqlbrowsr on server firewall
be concerned about security - if you can rdp/connect to sql w/o vpn, then so can other people - so you better make sure you have hardened environment and very strong passwords.
Depending on the specific access technology, different syntaxes for connection strings are needed. For the .NET provider, the syntax allows for passing server addresses.
Here's a sample connection ADO.net connection.
imports System.Data.SqlConnection
...
dim cn as new SqlConnection()
cn.connectionString = "Server=192.168.1.200;Database=mydbName;user id=notSA;password=C0mp!3xPVVD"
cn.open()
...
'Do cool stuff
...
cn.close()
Open up port TCP 1433 (Sql Server) on the remote server
And for your connection string jus use the IP Address for the Server, instead of using the computer name
You should be able to interchange between computer name and IP address without any problems, because the Computer Name gets turned into an IP Address anyway.