Java Connector
Akash
java
2 years ago
558 B
3
Indexable
Never
import java.sql.*; public class assign9 { public static void main(String[] args) { try { Class.forName("com.mysql.cj.jdbc.Driver"); Connection con=DriverManager.getConnection( "jdbc:mysql://10.10.12.108:3306/te31141Adb","te31141A","te31141A"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from Dept"); while(rs.next()) System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3)); con.close(); } catch(Exception e) { System.out.println(e); } } }