Advertisement
Guest User

Untitled

a guest
Jan 16th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. public class lawl {
  4.    
  5.     static Connection con = null;
  6.     static Statement stmt = null;
  7.     static ResultSet rs = null;
  8.    
  9.     public static void main(String[] args){
  10.         try
  11.         {
  12.             con = DriverManager.getConnection("jdbc:mysql://vweb14.nitrado.net/ni170586_5sql6", "ni170586_5sql6", "test");
  13.             stmt = con.createStatement();
  14.             rs = stmt.executeQuery("SELECT * FROM test");
  15.            
  16.             while(rs.next()){
  17.                 System.out.println(rs.getString("name"));
  18.             }
  19.         }
  20.         catch(Exception ex)
  21.         {
  22.             System.out.println(ex);
  23.         }
  24.     }
  25.    
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement