Sharing Microsoft SQL server 2005 database in the LAN network

By wadmansoori ·
I am working on a domain network. We have the Microsoft SQL server 2005 database installed in the server.
1) I need some other users to get access to this database from their computers.
How can I do that?
2) I have some data which is stored in a text file and CSV files. I need to load that data to the new tables that I have in the current database which is MS SQL. How can I do that?
Please let me know if you have any answer for the two questions.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Example using Visual c#

by drmk1245 In reply to Sharing Microsoft SQL ser ...

Prerequisites: On server
1. Make sure you set the database for assess in dual mode,windows and sqlserver and add a userlogin say user name Logme, password 123abc.
It is important to check the sql server properties, and add this new login and make sure that permissions are set for select, update, etc, or you will get a login failure

2. Check your surface configuration manager
and nake sure remore server access is enabled,in addition to TCP and names pipes

reboot server

There are several ways to access the data over a lan, the following example uses Visual C#

String ConnectionString= "Data Source = server name on LAN; Initial Catalog= database name on server; User Id= logme; Password= 123abc; Trusted_Connection=False";

SqlConnection cn=New Sql Connection(connectionString);

String sqlwhatever = "Select * from yourtable";

Sqlcommand command=new Sqlcommand(sqlwhatever,cn);

String sql = "Insert yourtable (ID,Lname,Fname) Values('";
sql=sql+"123456 ',";
command.CommandTimeout= 20;
command.Connection= cn;

Hope that helps


Collapse -

Reponse To Answer

by Rasin ravi In reply to Example using Visual c#

how can i share my share my sql server database over lan using "JAVA" code ?

Collapse -

You don't share it as such, it's not a file. How you give them

by Tony Hopkinson In reply to Sharing Microsoft SQL ser ...

access deoends on you setup but basically.
Run up sql server manager connect to the server (must be an admin of the server).
The logins allowed are Security -> Logins in the tree view. You can add windows users, mess about with trusts if they are in a different domain. Then in there you map a login to a user in teh databases they are allowed to access. If you use AD, you can set up groups and stuff and it will sort it all out for you.
If you aren't in domain, then you can add windows users that the server (where sql server is) knows about. Or you can shift teh security model to mixed (not recomended) and create sql logins (non integrated).

PS make sure of what privileges on the data base and the sql server you give them. You would n't want them deleting the database, or some such...
That depends on the sql user you map the login to , so if you wanted to give them read only access, create a user in the database e.g. onlylooking, give it select and references privileges) then map the login to it.
Oh and you'll need to make sure TCP/IP is enabled in SQL Server Configuration Manager.

And make sure sqlserver and SQL Browser ports are okay though any internal firewalls, e.g. if the server wwith sql server on has windows firewall going.

Related Discussions

Related Forums