package test;

import common.DBTool;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DBTest {
    public static void main(String[] args) {
        String testSql = "select * from t_user";
        try {
            Class.forName("common.DBTool");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
        try {
            PreparedStatement ps = DBTool.getPreparedStatement(testSql);
            ResultSet rs =  ps.executeQuery();
            while (rs.next()) {
                System.out.println(rs.getString(1));
                System.out.println(rs.getString(2));
                System.out.println(rs.getString(3));
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
