vb.net 在 SQL Server 2005 Express 中创建供家庭使用的数据库服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20129729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 15:55:20  来源:igfitidea点击:

Creating a Database Server for home use in SQL Server 2005 Express

sqlsql-servervb.netsql-server-2005sql-server-2005-express

提问by dmoney

I am looking to create a database server that can be used to store data using a VB.net application. When I initially installed SQL Server 2005 Express edition, I believe I installed this using the LocalDB option.

我希望创建一个可用于使用 VB.net 应用程序存储数据的数据库服务器。当我最初安装 SQL Server 2005 Express 版本时,我相信我是使用 LocalDB 选项安装的。

As it stands my application is a simple tool which utilises the Process.Start command under certain situations, depending on user input, to launch Game Servers for use at a gaming LAN I assist in running.

就目前而言,我的应用程序是一个简单的工具,它在某些情况下利用 Process.Start 命令,根据用户输入,启动游戏服务器以在我协助运行的游戏 LAN 上使用。

I wish to progress the application by being able to update, delete and query a database created in SQL Server 2005 Express. I understand the use of connection strings etc, however I am wondering if the installation using LocalDB will mean that I cannot connect to the server to process the data I require.

我希望通过能够更新、删除和查询在 SQL Server 2005 Express 中创建的数据库来改进应用程序。我了解连接字符串等的使用,但是我想知道使用 LocalDB 的安装是否意味着我无法连接到服务器来处理我需要的数据。

Can I continue to use the LocalDB option and create a Database Server for specific use using my application or is a different installation option required?

我可以继续使用 LocalDB 选项并使用我的应用程序创建特定用途的数据库服务器还是需要不同的安装选项?

Secondly, can someone point me in the right direction of how to create a new Server for this purpose? All of my searches so far have provided results for creating a database only, and not the server.

其次,有人可以指出我如何为此目的创建新服务器的正确方向吗?到目前为止,我所有的搜索都只提供了创建数据库的结果,而不是服务器。

回答by CRAFTY DBA

I have a couple questions about what you are trying to do.

我有几个关于你正在尝试做什么的问题。

First, why are you installing SQL Server 2005? It was released almost a decade ago.

首先,为什么要安装 SQL Server 2005?它大约在十年前发布。

I would go with 2012 express edition.

我会选择 2012 速成版。

http://www.microsoft.com/en-us/download/details.aspx?id=29062

http://www.microsoft.com/en-us/download/details.aspx?id=29062

Second, install the management tools. SSMS is a nice GUI to do work in.

其次,安装管理工具。SSMS 是一个很好的图形用户界面。

Third, If you are spinning up anything other than express, there are licensing costs which are quite high. 9K for standard and 25K for enterprise per socket or such.

第三,如果您要旋转快递以外的任何东西,则许可成本非常高。每个插槽或类似的标准为 9K,企业为 25K。

Here are the versions and features list from microsoft.

这是微软的版本和功能列表。

http://technet.microsoft.com/en-us/library/ms144275.aspx

http://technet.microsoft.com/en-us/library/ms144275.aspx

Last but not least, having the express edition on another computer is fine. However, you will have to use a network protocol such as TCP/IP instead of shared memory.

最后但并非最不重要的一点是,在另一台计算机上安装 express 版本很好。但是,您将不得不使用 TCP/IP 等网络协议而不是共享内存。

It will take longer to send Tabular Data Stream (TDS) to the other computer versus talking to memory on the same computer.

与与同一台计算机上的内存通信相比,将表格数据流 (TDS) 发送到另一台计算机需要更长的时间。

http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c4f06669-41fd-42e6-b4a9-564cf04ca9f7/how-to-choose-between-shared-memory-named-pipes-tcpip-via?forum=sqlgetstarted

http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c4f06669-41fd-42e6-b4a9-564cf04ca9f7/how-to-choose-between-shared-memory-named-pipes-tcpip-via?论坛=sqlgetstarted

Good luck with your project.

祝你的项目好运。

回答by Hart CO

You can use a local instance of SQL Server just fine, if you want to set up a separate server for some reason then you'll need either a 2nd machine on which to install SQL Server, or to spin up a virtual machine. If running Windows 8 (and barring hardware limitations) you have Hyper-V at your fingertips.

您可以使用 SQL Server 的本地实例就好了,如果您出于某种原因想设置单独的服务器,那么您需要在第二台机器上安装 SQL Server,或者启动虚拟机。如果运行的是 Windows 8(并且排除硬件限制),则 Hyper-V 触手可及。

回答by RacerNerd

This is not a complete answer for you but may give you some things to think about.
First you might want to think about your choice of database. If you don't have a compelling reason for using 2005 you will probably at least want to move to SQL Express 2008.

这对你来说不是一个完整的答案,但可能会让你思考一些事情。
首先,您可能要考虑对数据库的选择。如果您没有使用 2005 的令人信服的理由,您可能至少希望迁移到 SQL Express 2008。

Second, to answer the part about creating a server... A server is something that serves data. In a general sense a computer configured to be contacted by external machines and respond with data is a server. A web server runs a program like IIS or Apache to respond with web pages. A database server contains a database and allows connections to that database. So as long as you install the database on a computer and configure it to allow external connections, you have your database server.

其次,回答关于创建服务器的部分......服务器是提供数据的东西。在一般意义上,配置为与外部机器联系并以数据响应的计算机是服务器。Web 服务器运行 IIS 或 Apache 之类的程序来响应网页。数据库服务器包含一个数据库并允许连接到该数据库。因此,只要您在计算机上安装数据库并将其配置为允许外部连接,您就拥有了数据库服务器。

In MS SQL there are several things that need to be set up to allow a database to accept external connections. One is that the SQL Server Browser service will need to be active. Another is that the database itself will need to be configured to allow external connections (SQL Authentication type probably).

在 MS SQL 中,需要进行一些设置以允许数据库接受外部连接。一是 SQL Server Browser 服务需要处于活动状态。另一个是数据库本身需要配置为允许外部连接(可能是 SQL 身份验证类型)。

Hope this helps.

希望这可以帮助。

Addition:

添加:

SQL Remote Connection Configuration Disclaimer, I don't have SQL Express 2005 installed but I think the settings are found in the same place in 2008. If the info here is not exact to SQL Express 2005, the general terminology used here should be enough to get you headed in the right direction to find the specifics.

SQL 远程连接配置免责声明,我没有安装 SQL Express 2005,但我认为这些设置是在 2008 年的同一个地方找到的。如果这里的信息与 SQL Express 2005 不准确,这里使用的通用术语应该足够了让您朝着正确的方向前进以找到细节。

While viewing the database in Server Management Studio or Enterprise Manager, right click the database server instance name (the root of the tree) and select properties. There should be a section title Connections and within this section there should be an option "Allow remote connections to this server". Make sure it is checked. The other setting you need in this properties menu is under the security area. There is a radio button for "Windows Authentication Mode" and "SQL Server and Windows Authentication Mode", you want the second that allows both.

在 Server Management Studio 或 Enterprise Manager 中查看数据库时,右键单击数据库服务器实例名称(树的根)并选择属性。应该有一个标题为“连接”的部分,并且在该部分中应该有一个选项“允许远程连接到此服务器”。确保它被检查。您需要在此属性菜单中进行的其他设置位于安全区域下。“Windows 身份验证模式”和“ SQL Server 和 Windows 身份验证模式”有一个单选按钮,您需要第二个允许两者。

The next step you have may be to create a new user, add a password, and connect the user to the database. That will give you the credentials you will use in your database connection string while programming. I usually add new users through the security section of the database then set the User Roles for each database that I need to connect to. It is good practice to limit the permissions to those needed by the application. Typically this is read and write, but sometimes you can get away with just read. The less the better.

您的下一步可能是创建一个新用户、添加密码并将用户连接到数据库。这将为您提供在编程时将在数据库连接字符串中使用的凭据。我通常通过数据库的安全部分添加新用户,然后为我需要连接的每个数据库设置用户角色。将权限限制为应用程序所需的权限是一种很好的做法。通常这是读取和写入,但有时您可以只读取。越少越好。