Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JDBC and Relational Databases
No output while running JDBC program with MySQL
Abhimanyu Jain
Ranch Hand
Posts: 151
1
I like...
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Following is the code that compiles without any exception or error but also shows no output:-
import java.sql.*; class MysqlCon { public static void main(String args[]) { try { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Mohit","root","1234"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from emp"); while(rs.next()) { System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getInt(3)); } con.close(); } catch(Exception e) { System.out.println(e); } } }
Paul Clapham
Marshal
Posts: 28193
95
I like...
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This could easily happen if you had an empty "emp" table.
Abhimanyu Jain
Ranch Hand
Posts: 151
1
I like...
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thank you! It worked after inserting the data.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
ClassNotFoundException Mysql
ClassNotFoundException with ResourceBundle
Database connection
Getting an Exception wile accessing data
JDBC ClassNotFoundException help please
More...