package com.offcn.TestUnti;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class MySqlUtil {
	//查询表名tableName的条件是condition的结果集
	 
		public ResultSet selectFromDB(String tableName, String condition) throws Exception {
			Connection conn = null;
			String sql;
			ResultSet rs = null;
			String url = ReadProperties.GetPropertyByKey("sqlurl");

			Class.forName("com.mysql.jdbc.Driver");
			conn = DriverManager.getConnection(url);
			Statement stmt = conn.createStatement();
			sql = "select * from " + tableName + " where " + condition;
//			 System.out.println("select_sql="+sql);
			rs = stmt.executeQuery(sql);
			return rs;

		}
}
