一个B/S的聊天程序,带数据文件

源代码在线查看: chatreg.java

软件大小: 54 K
上传用户: smashup
关键词: 程序 数据文件
下载地址: 免注册下载 普通下载 VIP

相关代码

				package test;
				import java.sql.*;
				
				public class  chatreg{
				String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
				String sConnStr = "jdbc:odbc:chatreg";
				Connection conn = null;
				ResultSet rs = null;
				
				public chatreg() {
				try {
				Class.forName(sDBDriver); 
				}
				catch(java.lang.ClassNotFoundException e) {
				System.err.println("chatreg(): " + e.getMessage());
				}
				}
				
				public ResultSet executeQuery(String sql) {
				rs = null;
				try {
				conn = DriverManager.getConnection(sConnStr); 
				Statement stmt = conn.createStatement();
				rs = stmt.executeQuery(sql);
				} 
				catch(SQLException ex) { 
				System.err.println("aq.executeQuery: " + ex.getMessage());
				}
				return rs;
				}
				}
							

相关资源