SQL Server 2008 Connection JDBC Text

Source: Internet
Author: User
Tags mixed stmt management studio sql server management sql server management studio

SQL Server 2008 is the most commonly used SQL database on Windows, and the 2008 installation mechanism is based on the framework rewrite, which is very time-consuming (my laptop configuration is OK.) ^_^). But do not need the original ISO or hidden MSI file (if you accidentally delete these installation files manually, do not worry.) This is why, most of the time, the installation log file for SQL Server 2008 Setup.log has a 1G size. Because the installation process is too large.

SQL Server 2008 is a major product release that introduces many new features and key improvements that make it the most powerful and comprehensive version of SQL Server to date.

Installation of SQL Server 2008:

Download the ISO installation file for SQL Server 2008, open with a virtual optical drive, and run Setup

Select "Install"-> "new SQL Standalone Installation"

Start the installation, the middle of the need to fill in the database instance, select a mixed password login.

Instances of arbitrary naming

Account name as shown select NT Authortiysystem

The authentication mode is set to mixed mode and the password is set. Select Add Current user (System administrator).

SQL Server 2008 Configuration

After the installation is complete, SQL Server Management Studio is the database management program, and SQL Server Configuration Manager is the configuration program.

When you log on to SSMS (SQL Server Management Studio), the server name format is the instance name that is filled in (local) installation, authentication is SQL authenticated, and the login name is the system default SA, and the password is the password that you set when you installed the blend mode.

If you cannot log in, select Windows to log in, and then "security"-> "login"-> "sa"-> "status" set to Enabled, detailed as shown.

Open SQL Server Configuration Manager

Select the protocol for the instance that you established in the SQL Server network configuration, select the TCP/IP protocol set to Enabled, set one IP to native 127.0.0.1, and set to Enabled. The IP all port is then set to 1433, and the dynamic port is set to null. As pictured.

Similarly, the port of the client is also set to 1433, enabled.

Then! You must restart the SQL Server service, or it will not work even if the computer restarts.

SQL Server 2008 Connection JDBC

OK, start your ssms, right key to the database, "Create a new database"

Create a table after the database, such as the figure, after the table to edit the table to the table right key edit the first 200 lines.

Start to manipulate the connection jdbc in eclipse:

The first to use the connection drive, the official driver is Sqlserver4.jar, but this package is sometimes not used, here with the Jtds Drive, JDK1.6 with Jtds 1.2.6. JDC1.7 with 1.3.0. Then add an external jar (add extern jar) in the Eclipse "project" Property "Build Path"

Website Download Address:

Then you can start writing the test code:

[Java] View plaincopy

String jdriver = "Net.sourceforge.jtds.jdbc.Driver"; Jtds Driver Code

DB = "Jdbc:jtds:sqlserver://127.0.0.1:1433;datebasename=school"; URL connection

Test

[Java] View plaincopy

String jdriver = "Net.sourceforge.jtds.jdbc.Driver";

String connectdb = "Jdbc:jtds:sqlserver://127.0.0.1:1433;datebasename=school";

try {

Class.forName (Jdriver);

catch (Exception e) {

SYSTEM.OUT.PRINTLN ("Load Database engine failed");

System.exit (0);

}

SYSTEM.OUT.PRINTLN ("Database load succeeded");

String user = "sa";

String password = "xxxxxxxxxxxxxxxx";

System.out.println ("Ready to connect ...");

Connection Connection = drivermanager.getconnection (Connectdb,user,password);

System.out.println ("connected successfully");

Statement stmt = Connection.createstatement ();

String sql0 = "Use database name";

Stmt.execute (sql0);

Here's a little note that when you use a database in eclipse, it's best to add a phrase to the front.

String sql0 = "Use database name";

Stmt.execute (sql0);

Otherwise, it looks like the operation of the table will be done in the system database rather than in the database that you set up.

Last SQL Server 2008 successfully connected to JDBC

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.