1. Software Installation and account setup 1-1. Install "ms SQL Server 2005 (SP2)" (select the local account for the built-in account, and select the windows and SQL hybrid modes for the logon mode, the password can be set. If no built-in account SA is set, use winnt to log on to "SQL Server Management Studio", select Security> Logon Name> Sa> logon attribute, and set the password, disable "SQL Server Management Studio") 1-2. Install "myeclipse 6.6.1 Ga" (or other versions) 1-3. Download the connection driver package "sqljdbc. jar "2. Set the SQL Server server: 2-1." Start "→" Program "→" Microsoft SQL Server 2005 "→" configuration tool "→" SQL Server Configuration Manager "(confirm that" SQL Server Management Studio "is disabled) 2-2. Stop "SQL Server (sqlexpress)" in "SQL Server 2005 service" (started by default) 2-3. Choose "SQL Server 2005 network configuration"> "MSSQLServer protocol" to start "TCP/IP" (disabled by default ), double-click "TCP/IP" to go to the property settings. In "ip address, check that "TCP port" in "ipall" is 14332-4, and "SQL Server 2005 service" starts "SQL Server (MSSQLServer)" (stopped by default) 2-5. Disable "SQL Server Configuration Manager" (you can start "SQL Server Management Studio" and log on with the account SA and password. If the SQL Server server is correctly set, you should be able to log on successfully) 3. Create a test database and table: Start "SQL Server Management Studio" and log on with the account SA and password (if the SQL Server server is correctly set, you should be able to log on successfully) to create a database jsptest, create a register4 table, create a Java project and Code 4-1. Start "myeclipse" → "file" → "new" → "project" → "Java Project ", name the Test4-2, open "properties" for test → "Java build path" → "Libraries" → "add external jars", and select the downloaded connection driver package "sqljdbc. jar, and then click "OK" to confirm 4-3. Create a test class and write the following code: Import Java. SQL. *; public class test {public static void main (string [] ARGs) {connection con = NULL; statement stmt = NULL; resultset rs = NULL; try {class. forname ('com. microsoft. sqlserver. JDBC. sqlserverdr Iver '); con = drivermanager. getconnection ('jdbc: sqlserver: // localhost: 1433; databasename = jsptest', 'sa ', 'sa'); // class. forname ('Sun. JDBC. ODBC. jdbcodbcdriver '); // con = drivermanager. getconnection ('jdbc: ODBC: jdbcsqldemo_jsptest'); stmt = con. createstatement (); RS = stmt.exe cutequery ('select username, password, email from regist'); While (RS. next () {string strusername = Rs. getstring (1); string strpassword = rs. Getstring (2); string stremail = Rs. getstring ('email '); system. out. println (strusername + '\ t' + strpassword +' \ t' + stremail + '\ t');} If (RS! = NULL) Rs. Close (); If (stmt! = NULL) stmt. Close (); If (con! = NULL) con. Close ();} catch (exception e) {e. printstacktrace ();} finally {system. Out. println ('demo completed! ') ;}} 4-4. Run the code. The data in the register table 4-5 should be displayed. The annotated part of the code is the ODBC bridge connection code, you can choose 4-6. If you used JDBC to connect to SQL Server 2000, you should note that the statement for loading the driver and URL path in SQL Server 2000 is "com. microsoft. JDBC. sqlserver. sqlserverdriver "" JDBC: Microsoft: sqlserver: // localhost: 1433; databasename = jsptest "while SQL Server 2005 loads the driver and URL statement as" com. microsoft. sqlserver. JDBC. sqlserverdriver "" JDBC: sqlserver: // localhost: 1433; databasename = jsptest "pay attention to the differences between the two