一、PreparedStatementUpdaeTest.java
package com.atguigu3.preparedstatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.junit.Test;
import com.atguigu3.bean.Customer;
import com.atguigu3.util.JDBCUtils;
public class PreparedStatementUpdaeTest {
@Test
public void testQuery() {
Connection conn = null;
PreparedStatement ps = null;
ResultSet resultSet = null;
try {
conn = JDBCUtils.getConnection();
String sql = "select id,boyName,userCP from boys where id = ?";
ps = conn.prepareStatement(sql);
ps.setObject(1, 81);
resultSet = ps.executeQuery();
if (resultSet.next()) {
int id = resultSet.getInt(1);
String boyName = resultSet.