@@ -0,0 +1,1430 @@
+package models;%0D%0Aimport java.sql.*;%0D%0A%0D%0Apublic class ConDBSQL %7B%0D%0A%0D%0A%09public static void main(String args%5B%5D) %7B%0D%0A%0D%0A%09%09// Criando as variveis de conexo e de statement%0D%0A%09%09Connection con;%0D%0A%09%09Statement stmt;%0D%0A%09%09String query = %22select name , id from sysobjects%22;%0D%0A%0D%0A%09%09// Verificando se o driver JDBC est instalado e pode ser utilizado%0D%0A%09%09try %7B%0D%0A%09%09%09Class.forName(%22com.microsoft.jdbc.sqlserver.SQLServerDriver%22);%0D%0A%0D%0A%09%09%7D catch (java.lang.ClassNotFoundException e) %7B%0D%0A%09%09%09System.err.print(%22ClassNotFoundException: %22);%0D%0A%09%09%09System.err.println(e.getMessage());%0D%0A%09%09%7D%0D%0A%0D%0A%09%09try %7B%0D%0A%09%09%09// Abrindo a conexo com o servidor MAURO, login sa e sem senha%0D%0A%09%09%09con = DriverManager.getConnection(%0D%0A%09%09%09%09%09%22jdbc:microsoft:sqlserver://MAURO:1433%22, %22sa%22, %22%22);%0D%0A%0D%0A%09%09%09stmt = con.createStatement();%0D%0A%09%09%09// Criando a instruo a partir do SELECT que est dentro da%0D%0A%09%09%09// varivel query%0D%0A%09%09%09ResultSet rs = stmt.executeQuery(query);%0D%0A%0D%0A%09%09%09System.out.println(%22Lista de linhas da tabela sysobjects:%22);%0D%0A%0D%0A%09%09%09// Fazendo um loop para mostrar tudo o que foi retornado do banco%0D%0A%09%09%09while (rs.next()) %7B%0D%0A%0D%0A%09%09%09%09// Obtendo o campo name em um string%0D%0A%09%09%09%09String s = rs.getString(%22name%22);%0D%0A%09%09%09%09// Obtendo o campo id em um inteiro%0D%0A%09%09%09%09int i = rs.getInt(%22id%22);%0D%0A%09%09%09%09System.out.println(s + %22   %22 + i);%0D%0A%09%09%09%7D%0D%0A%0D%0A%09%09%09// Fechamdno a instruo e a conexo%0D%0A%09%09%09stmt.close();%0D%0A%09%09%09con.close();%0D%0A%0D%0A%09%09%7D catch (SQLException ex) %7B%0D%0A%09%09%09System.err.println(%22SQLException: %22 + ex.getMessage());%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%7D%0D%0A

Package Models.