| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.example.springboot.entity.Glass; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | @Component |
| | | public class JdbcConnections { |
| | | /** |
| | |
| | | private static PreparedStatement ps = null; |
| | | private static ResultSet rs = null; |
| | | |
| | | public Glass selectGlass(int glassid) throws SQLException { |
| | | public north_glass_buffer1 selectGlass(int glassid) throws SQLException { |
| | | conn = getConn(); |
| | | Glass glass=new Glass(); |
| | | String sql = "select orderid from glass where glassid=?"; |
| | | north_glass_buffer1 glass=new north_glass_buffer1(); |
| | | String sql = "select ordernumber from north_glass_buffer1 where glassid=?"; |
| | | ps = conn.prepareStatement(sql); |
| | | ps.setInt(1, glassid); |
| | | rs= ps.executeQuery(); |
| | | while (rs.next()) { |
| | | glass.setOrderId(rs.getShort("orderid")); |
| | | glass.setordernumber(rs.getString("ordernumber")); |
| | | } |
| | | conn.close(); |
| | | return glass; |
| | |
| | | */ |
| | | public static Connection getConn() throws SQLException { |
| | | Connection conn = null; |
| | | conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/canadameserp?serverTimezone=GMT%2B8&characterEncoding=utf-8", "root", "beibo.123/"); |
| | | conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/canadames?serverTimezone=GMT%2B8&characterEncoding=utf-8", "root", "beibo.123/"); |
| | | return conn; |
| | | } |
| | | |