1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Connection connection = null;
try
{
Class.forName("la classe du driver JDBC");
connection = DriverManager.getConnection("url DB", "user", "password");
PreparedStatement pstmt = connection.prepareStatement("select CODECONTACT, PRENOM, NOM, LIENCLIENT, TELEPHONE1, TELEPHONE2 from CONTACT where codecontact in (select codecontact from clientcontact where codeclient=?)");
pstmt.setString(1, jTFCodeClient);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
...
}
}
catch (Exception e)
{
...
}
finally
{
if ( connection != null ) connection.close();
} |
Partager