Issue
I want to build a simple login/register Java application using NetBeans 12.3 and I don't know how can I use the data in a table that I have created in MySQL database (login table contains two columns username/password).
In fact I connected MySQL database to NetBeans 12.3 using the services-->database-->right
click new connection and picked the MySQL connector Java that I downloaded previously and it said that the connection worked. But I don't get it how can I use the data in that table in my program should I write some code specific to get the data inside my classes and use it.
Solution
You can connect using normal JDBC.
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("url","username","password");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("Query");
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
con.close();
}catch(Exception e){ System.out.println(e);}
Please let me know if you are facing any different issue. regards, Vishal
Answered By - Vishal Yadav