Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.36 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Java> Eclipse and SQL Server
  2. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  3. String connectionUrl = "jdbc:sqlserver://localhost"
  4. Connection con = DriverManager.getConnection(connectionUrl);
  5. Statement s = con.createStatement();
  6. ResultSet r = s.executeQuery("SELECT * FROM some_table_name");
  7. while (r.next()) {
  8.     System.out.println(r.getString(1));
  9. }