第二次冲刺 02
今日进行站立会议,主要是对于下一步的进行做出规划要求。
如何优化整个项目的进程进行分析。
昨天写错地方了。。。。

package com.example.math.repositiory; import com.example.math.jdbc.JDBCtools; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class Mer_login { public static List<String> findAllName() throws Exception { List<String> list = new ArrayList<>(); Connection conn = JDBCtools.getConnect(); PreparedStatement pre = null; ResultSet res = null; String sql = "select mer_phone from mer_login"; try { pre = conn.prepareStatement(sql); res = pre.executeQuery(); while (res.next()) { String name = res.getString("mer_phone"); list.add(name); } } catch (SQLException e) { throw new RuntimeException(e); } finally { JDBCtools.release(conn, pre, res); } return list; } public static String findAddress(String mer_name) throws Exception { Connection connection = JDBCtools.getConnect(); PreparedStatement preparedStatement = null; ResultSet resultSet = null; String address = null; String sql = "select address from mer_login where mer_phone = ?"; try { preparedStatement = connection.prepareStatement(sql); preparedStatement.setString(1,mer_name); resultSet = preparedStatement.executeQuery(); while (resultSet.next()){ address = resultSet.getString("address"); } } catch (SQLException e) { throw new RuntimeException(e); }finally { JDBCtools.release(connection,preparedStatement,resultSet); } return address; } }

浙公网安备 33010602011771号