|
|
| regarding jdbc |
Expert:tushar087
how to connect mysql with java example you have provided is having some error and i am not able to remove that error please provide me detail explanation |
| Answers |
Hi friend,
Please give the full source code and details having the error to solve the Problem.
Thanks
|
use this code for connection in ur program
Connection con = null; try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/yourdatabase", "your username", "your password"); } catch (Exception e) { e.printStackTrace(); }
this code for getting connection only. After getting connection we use "con" for ur next processing.
like Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(your query);
while(rs.next){ // do ur stuff like rs.getString("name"); }
these thing happens insdie try block
Rajanikant
|
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|