package teste;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class TesteBancoDados {
	
	private static final String URL = "jdbc:mysql//localhost:3306/"; 
	
	public void acessar() throws SQLException {
//		Class.forName("com.mysql.jdbc.Driver");
		DriverManager.registerDriver(new com.mysql.jdbc.Driver());
		Connection conn = DriverManager.getConnection(TesteBancoDados.URL, "root", "alunoifba");
		Statement stmt = conn.createStatement();
		ResultSet rSet = stmt.executeQuery("SELECT * FROM SERVIDOR_BASICO");
		while(rSet.next()) {
			System.out.println(rSet.getString("id"));
		}
		rSet.close();
		stmt.close();
		conn.close();
	}
	
	public static void main(String[] args) throws SQLException {
		(new TesteBancoDados()).acessar();
	}

}
