创建中间企业对象层
源代码在线查看: kylelist_sql2000.java
/**
* @author duke
* @version 1.2
* @date 2004-8-10 14:37
*/
package com.kyle.eobject;
import java.io.*;
import java.sql.*;
import com.microsoft.jdbc.sqlserver.SQLServerDriver;
public class KyleList
{
public KyleList() throws Exception
{
}
public void list() throws Exception
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://192.168.0.91:1433;DatabaseName=EPORTALDB";
//test你的数据库的
String user="sa";
String password="sa";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select count(*) as n from Region";
ResultSet rs=stmt.executeQuery(sql);
while (rs.next())
{
System.out.println(rs.getString("n"));
}
rs.close();
}
public static void main(String args[]) throws Exception
{
System.out.println("sss");
KyleList t = new KyleList();
t.list();
}
}