创建中间企业对象层

源代码在线查看: kylelist_sql2000.java

软件大小: 528 K
上传用户: syxie
关键词: 对象
下载地址: 免注册下载 普通下载 VIP

相关代码

				/**
				 * @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();
					
					}
				}			

相关资源