Abdullah047

Display_SQL

Sep 2nd, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package sqltest;
  7. import java.sql.*;
  8. /**
  9.  *
  10.  * @author Abdullah
  11.  */
  12. public class Display {
  13.     public static void main(String[] args) throws SQLException{
  14.         String url="jdbc:mysql://localhost:3306/hawk?autoReconnect&useSSL=false";
  15.     Connection con=DriverManager.getConnection(url,"root","abdullah");
  16.     Statement NS=con.createStatement();
  17.     ResultSet Output=NS.executeQuery("SELECT * FROM table1");
  18.    
  19.     while(Output.next()){
  20.   System.out.println(Output.getString("ID")+"\t"+Output.getString("NickName"));
  21.        
  22.     }
  23.    
  24.     }
  25. }
Add Comment
Please, Sign In to add comment