Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database Issue when displaying data.

 
Mayur Saparia
Greenhorn
Posts: 19
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Output:

1 (user_id of first record)
12 (user_id of second record)
lalit
gm
lalit
admin
1
BUILD SUCCESSFUL (total time: 0 seconds)



Here my problem is that i have two records in database with primary key the user_id, as you can see the user_id of first record is getting printed and and then it prints rest of the second record.
I am clueless about it. It just prints the user_id of the first record and no other things of that records.

I am using Netbeans so please consider it while answering the question.
Please let me know what is the problem.

Thanks in advance.
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
What is the output of query looks like when you fire it in MYSQL itself?

regards,
amit
 
Mayur Saparia
Greenhorn
Posts: 19
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No its the output from the java code.. I havent wrote anything before it so its just displaying the values of the database.
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Did you check if you have "any" data for other columns apart from userid for the first record in the database. (userid = 1) ?
Can you confirm it by running query using MySQL UI and checking the output?

regards,
amit
 
Vinod Tiwari
Ranch Hand
Posts: 466
1
IntelliJ IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mayur - I would advise you to check if other values in database are null or not. May be those values are null in database and you are trying to debug a non-issue.

BTW - your code looks fine.

Vinod
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic