Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
    Bookmark Topic Watch Topic
  • New Topic

ResultSet  RSS feed

bahri sirine
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm trying to know how many objectid in the resultset 1 have the same objectid in the Resultset 2.When I execute this I obtained just the objectid which are places in the same Rowin two tables .So any help please how can I correct this code:

try {
int count = 0;

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/stage2", "root", "");
System.out.println("succés de connexion");
Statement stm = con.createStatement();
ResultSet Rs = stm.executeQuery("select idep from professeur");

Connection con1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/stage3", "root", "");
System.out.println("succés de connexion1");
Statement stm1 = con1.createStatement();
ResultSet Rs1 = stm1.executeQuery("select idetudiant from etudiant");

int k = 0, j = 0;

while ( {
j = Rs.getInt("idep");

// System.out.println("j" + j);
while ( {
k = Rs1.getInt("idetudiant");
if (k == j) {
System.out.println("k" + k + " j" + j);



} catch (Exception e) {
// TODO Auto-generated catch block
Roel De Nijs
Posts: 11338
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Report post to moderator
Duplicate topic. Discussion continued here.

Topic locked.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!