Advertisement
Guest User

Untitled

a guest
May 20th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. package bazededate;
  2.  
  3. import java.sql.*;
  4.  
  5. public class Main {
  6.    
  7.     public static void main(String[] args) throws Exception {
  8.         // import the db's driver - de luat de pe net + inclus in classpath / IDE
  9.         Class.forName("com.mysql.jdbc.Driver");
  10.         // connect to the db
  11.         Connection c =
  12.             DriverManager.getConnection("jdbc:mysql://192.168.0.79/laborator","laborator","laborator");
  13.         //TODO go play with your dick in the sand
  14.        
  15.         Statement stmt = c.createStatement();
  16.         ResultSet result = stmt.executeQuery("SELECT * FROM Persoane_1");
  17.         while (result.next())
  18.             System.out.println(
  19.                 result.getString("Prenume") + "\t" +
  20.                 result.getString("Nume") + "\t" +
  21.                 result.getInt("Salariu")
  22.             );
  23.     }
  24.    
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement