Netbean JDBC Connectivity
Netbean JDBC Connectivity
*;
class Test2{
try{
Class.forName("com.mysql.jdbc.Driver");
Connection c=DriverManager.getConnection("jdbc:mysql://localhost:3306/studb","root","admin123");
Statement st=c.createStatement();
while(rs.next()){
System.out.println(rs.getString(1));
}catch(Exception ee)
{System.out.println(ee);}
}}
import java.sql.*;
class Test2{
try {
Class.forName("com.mysql.jdbc.Driver");
Statement st = con.createStatement();
// while loop and with while loop code use for print the data
while (rs.next()) {
if (i > 1)
System.out.print(", ");
System.out.print(columnValue);
System.out.println("");
st.close();
con.close();
System.err.print("Exception: ");
System.err.println(ex.getMessage());