|
|
Số người truy cập: 3.505.651
Số người trực tuyến: 63Trong đó có 1 thành viên: Trương Tam
|
|
|
| Trang chủ .NET Việt Nam
>
Bài viết
>
Theo chủ đề
>
CSDL & ADO.NET | Configuring SQL Server Express 2005 | |
02:55' PM - Thứ hai, 05/05/2008 | | Configuring SQL Server Express 2005 for Remote Access
when SQL Server does not allow remote connections
Errors connecting to SQL Server Express 2005
Are you getting errors connecting to SQL Server Express 2005 via remote client software and yet
have no problem connecting to it on the local machine?
Some of the errors you might be seeing are:
- sql server does not allow remote connections
- SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified
- An error has occured while establishing a
connection to the server. 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.(provider:Named Pipes
Provider,error:40-Could not open connection to SQL Server))
- Server does not exist or access denied
If yes, then read on because SQL Server Express 2005 is not automatically configured for remote access
during installation. It can be enabled however, so the problems you are having are more of a
"feature" than a bug.
Here's a quick summary of the actions you need to take. The first three actions
have a separate page which provides more details and some screen shots of the procedure.
- Enable the TCP/IP protocol using the Surface Area Configuration Utility
- Make sure the TCP/IP protocol is enabled in the SQL Server Configuration Utility
- Make sure the SQL Server browser is started. Note this step
is optional. It is possible to set the SQL Server instance to use a fixed IP address - but this is
non-standard for named instances.
- Make sure SQL Server and SQL Server Browser are exempted by the firewall on the server machine.
This is done by putting sqlservr.exe and sqlbrowser.exe as an exception in the
windows firewall.
- Note: In order to get things to work. You might need to completely reboot the
server machine after making the changes. There have been reports (thanks P.C.) that starting and stopping the
SQL Server and Browser software is not enough.
Client software for testing remote connectivity to SQL Server Express 2005
Need some software to test out remote connectivity to SQL Server Express 2005?
Probably there are lots of ways. Here are four to try out:
- Download and install the SQL Server Management Studio Express Community Technical Preview.
SSMSECTP (as it is affectionately known) is a freebie, upgraded and cut down version of the
SQL Server 2000 management software. Works pretty well for simple management tasks, has a
T-SQL window and, of course, nicely tests out remote connectivity.
To install SSMSE you will need the following (note the 2.0 Beta version of the .NET framework is
not acceptable. Uninstall it first if you have it.).
It is probably best to install them in the order below
- Microsoft .NET Framework Version 2.0 Redistributable Package
- Microsoft Core XML Services (MSXML) 6.0
- Microsoft SQL Server Management Studio Express - Community Technology Preview (CTP) November 2005
- Or try the client side osql.exe utility with the following command line:
osql -S SERVERNAME\SQLEXPRESS -U <username>
To use OSQL, start up a Windows command session (Start:Run...:cmd) and
type in the above command. On our test machine the OSQL binaries are located in the
C:\Program Files\Microsoft SQL Server\90\Tools\Binn directory. If you do not
have this directory somewhere it probably means you did not install the client side tools.
So of course now the question is ""how to install the OSQL tool (and others) on the client"
Well fortunately it is not too difficult as they are co-located in the same installation
package as the SQL Server Express 2005 software. To install them just go back to the
same installer you used to create the SQL Server Express 2005 instance on the
remote system and run it on your client system. Instead of accepting the default
install (which installs the server engine) choose to install only the client side utilities.
This will create the above directory and install the tools without installing the
database on your client machine.
For further testing you can also dig around a bit and find out how to use the SQLCMD.exe utility.
- Or use the following snippet of C# code.
private void button1_Click(object sender, System.EventArgs e) { SqlDataReader rdr = null;
// 1. Instantiate the connection // test by server name instance name // SqlConnection conn = new SqlConnection( // "Data Source=MYSERVERNAME\\SQLEXPRESS; // Initial Catalog=Northwind; // User ID=sa; // Password=sa"); // test by ip address, port and instance name SqlConnection conn = new SqlConnection( "Data Source=123.123.123.123,1066; Network Library=DBMSSOCN; Initial Catalog=Northwind; User ID=sa;Password=sa;");
// 2. Open the connection conn.Open(); // 3. Pass the connection to a command object SqlCommand cmd = new SqlCommand( "select * from Customers", conn); // 4. Use the connection rdr = cmd.ExecuteReader(); // print the CustomerID of each record while (rdr.Read()) { Console.WriteLine(rdr[0]); } // close the reader if (rdr != null) { rdr.Close(); // 5. Close the connection if (conn != null) { conn.Close(); } MessageBox.Show("Done", "Done", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
Số lượt đọc:
453
-
Cập nhật lần cuối:
05/05/2008 02:59:18 PM | Hướng dẫn cài đặt Sql server 2005 06/06/2008 04:32' PM Hướng dẫn cài đặt bằng hình ảnh, version dành cho developer
Import text data to Sql Server 09/05/2008 12:29' AM Một cách rát hay để bạn có thể Import data vào 1 table trong DB của SQL Server từ một file text với định dạng giá trị theo field terminator: ‘,’,'\t’,'\n’,… Thông thường bạn hay dùng Code programing language như C#, VB, … để giải quyết nhưng với lượng dữ liệu lớn và cấu hình máy không phải mạnh bạn sẽ nhìn thấy rõ impact của việc dùng nó đến performance thế nào ngay. Vì vậy tốt nhất bạn sẽ dùng cách import data bằng ngay t-sql sẽ có performance cao hơn và dễ dàng customize hơn.
Những điểm mới trong SQL 200808/05/2008 11:49' PMSQL
Server 2008 sẽ được phát hành vào khoảng tháng 2 năm 2008, cùng với
phiên bản mới của Visual Studio và Windows. CTP (Community Technology
Preview) của SQL 2008 hiện đã được cung cấp trên internet và bạn có thể
download được từ URL của Microsoft. Trong bài này chúng tôi sẽ nhấn mạnh một số tính năng mới và các lợi ích mang lại của SQL Server 2008. Bài đã đăng: Những đặc điểm mới của ADO.NET 2.0 03/04/2008 12:04' AM Để
có thể làm giảm bớt những hạn chế về thể hiện của các phiên bản ADO.NET
trước đây và tăng tính mềm dẻo, Microsoft đã giới thiệu những đặc điểm
mới nhất trong ADO.NET 2.0 – Những đặc điểm mà có những sự khác biệt rõ
ràng so với phiên bản ADO.NET 1.1.
Giới thiệu cơ bản về SQL 02/04/2008 12:36' AM SQL
là gì? SQL Server 2000 là một hệ thống quản lý cơ sở dữ liệu
(Relational Database Management System (RDBMS) ) sử dụng Transact-SQL
để trao đổi dữ liệu giữa Client computer và SQL Server computer. Một
RDBMS bao gồm databases, database engine và các ứng dụng dùng để quản
lý dữ liệu và các bộ phận khác nhau trong RDBMS.
Các hàm Ranking mới trong SQL Server 2005 02/04/2008 12:13' AM Cùng
với SQL Server 2005, Microsoft đã giới thiệu một số tính năng mới và
những tính năng này sẽ giúp cho chuyên viên về DBA hay SQL Server dễ
dàng hơn trong việc viết mã và duy trì cơ sở dữ liệu SQL Server. Bài
này sẽ thảo luận về các hàm ranking mới được cung cấp trong SQL Server
2005.
Using ADO.NET06/03/2007 03:51' PM Một bài viết khá hay dành cho các bạn mới làm quen với .NET Tấn công kiểu SQL Injection và các phòng chống trong ASP.NET 07/05/2005 07:46' PM SQL Injection là một trong những kiểu hack web đang dần trở nên phổ biến hiện nay. Bằng cách inject các mã SQL query/command vào input trước khi chuyển cho ứng dụng web xử lí, bạn có thể login mà không cần username và password, remote execution, dump data và lấy root của SQL server. Công cụ dùng để tấn công là một trình duyệt web bất kì, chẳng hạn như Internet Explorer, Netscape, Lynx, ... Vậy khi lập trình web với ASP.NET, chúng ta cần phòng chống như thế nào?
|
|
|
|