By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

i want to connect wamp MySQL to my netbeans project

P: 4
I want to connect wamp:phpmyAdmin: mysql database with my netbeans java project. i wrote all connection code and also connect "mysql-connector-java-5.1.11-bin" and there is no error but when i'm running program that time it dose not working.
I want to Select and update data from wamp...
tell me how can i do this.....................
Mar 26 '13 #1
Share this Question
Share on Google+
5 Replies


10K+
P: 13,264
What do you mean by "does not work"? Do you get error messages?
What is the code that is not working? MYSQL, Java, PHP? you need to give people enough information for them to be able to help you.
Mar 26 '13 #2

P: 4
i wrote java code in NetBeans.
and I did't get any error msj it successfully run but on the out put screen my database data are't show...
Mar 26 '13 #3

10K+
P: 13,264
Put System.out.println statements showing the values of your variables to see why there is not data. Otherwise you'd have to post the relevant code.
Mar 26 '13 #4

P: 4
under these my netbeans code.....



Expand|Select|Wrap|Line Numbers
  1. Class.forName("com.mysql.jdbc.Driver");
  2.             Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/cloud", "root", "");
  3.             Statement stmt = con.createStatement();
  4.             String query = "select * from user";
  5.             ResultSet rs = stmt.executeQuery(query);
  6.             while (rs.next()) {
  7.                 String name = rs.getString("uname");
  8.                 System.out.println(name);
  9.             }
Mar 26 '13 #5

10K+
P: 13,264
1.) Use code tags when posting code.

2.) If this is a problem with Java code then it should be in the Java forum not MySQL forum.
3.)So nothing prints out to the console? Check that (a) There actually is data in the database and (b) that your code is not hiding exceptions.
Mar 26 '13 #6

Post your reply

Sign in to post your reply or Sign up for a free account.