Integration of sqlserver 2000 h and jdbc

Source: Internet
Author: User

SQL server 2000 is a widely used database system in network programming today, while java is a popular network programming language, in network programming, database issues are also important. java itself provides support for various mainstream database systems by providing java. the SQL database provides a unified interface, so that you do not have to modify the program in a large scale in the java environment. You only need to change the corresponding driver to perform operations on various databases, so as to improve the software life cycle and reduce software development costs and maintenance costs, in this case, the integration of SQL server 2000 and java becomes more important, this article briefly introduces the integration of SQL server 2000 and jdk.
System Requirements:
Database: SQL server 2000 sp3
Driver: SQL server driver for jdbc
Java version: jdk1.2 or later
1: We first use the jdbc-odbc bridge to connect databases. This is relatively simple.
First, use SQL server Enterprise to manage it to create a database test, and create a simple table first_table
Create an odbc Data Source by default.

Write a simple test program that connects to the database and performs a simple SQL operation. The Code is as follows:

/*************************************** ********
/*
/* DbTest. java
/*
/*************************************** *****/

Import java. SQL .*;

Public class DbTest {

Connection con;
Statement sta;
ResultSet rs;

String driver;
String url;
String user;
String pwd;
Public DbTest ()
{
Driver = "sun. jdbc. odbc. JdbcOdbcDriver ";
Url = "jdbc: odbc: store_manager ";
User = "share ";

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.