jsp的技术教程

源代码在线查看: conn.java

软件大小: 698 K
上传用户: srbrabbit
关键词: jsp 技术教程
下载地址: 免注册下载 普通下载 VIP

相关代码

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

相关资源