Home  >  Article  >  Database  >  SQL Server2005安装配置以及测试

SQL Server2005安装配置以及测试

WBOY
WBOYOriginal
2016-06-07 17:38:451025browse

SQL Server2005有2种版本,一种是集成版的, 一种是2个文件夹形式的。这里使用后者,安装文件夹名字为:SQL Server x86,该文件夹里面有Servers和Tools文件夹以及一些其他文件,前后点击里面setup.exe。next安装结束后(注意部=部分地方需要选择,比如选择安

SQL Server2005有2种版本,一种是集成版的, 一种是2个文件夹形式的。这里使用后者,安装文件夹名字为:SQL Server x86,该文件夹里面有Servers和Tools文件夹以及一些其他文件,前后点击里面setup.exe。next安装结束后(注意部=部分地方需要选择,比如选择安装哪些内容),基本配置如下:

1.打开MicroSoft SQL Server Management Studio,先配置一个数据库。在树形菜单数据库下直接新建一个数据库,建议数据库名字用英文。

2.然后在安全性树形菜单下面新建一个用户,SQL Serve身份验证,右键用户属性进行配置,注意常规设置下面的默认数据库默认语言不要改。在用户映射里面,映射为新创建的数据库。数据库角色成员身份下面,选中db_owner和public。

3. 然后右键新建的数据库的属性打开,进行配置。在权限上面,添加新建的用户名。

4.在SQL Server服务器上,右键属性设置,在树形菜单安全性上选择SQL Server和Windows身份验证。(很重要,如果在setup.exe里面已经选中则不必重新配置)。

5.打开程序里面的SQL Server Configuration Manager,在左边树形菜单里面,选择网络配置,,打开MSSQLSERVER协议,点击启用TCP/IP。(默认是不启用的,这一步也很重要)。

附录,下面是测试程序:

package test; import java.sql.*; public class TestSQLServer { public static Connection conn() { String driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; String url = "jdbc:sqlserver://localhost:1433;databaseName=GreatWall"; //123为数据库名字 String password="zy"; String user1 = "zy"; Connection conn = null; try { Class.forName(driverClassName); } catch (ClassNotFoundException ex) { System.out.println("加载错误!"); } try { conn = DriverManager.getConnection(url, user1, password); System.out.println("成功"); } catch (SQLException ex1) { ex1.printStackTrace(); } return conn; } main(String[] args) { conn(); } }


运行打印出 成功则说明安装成功(前提是工程里要有jdbc包)。

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn