Commit a5fbb0f7 by Patryk Czarnik

Jakieś popraweczki w przykładach

parent 80c294d3
...@@ -25,7 +25,7 @@ public class P07_GenerowaneId { ...@@ -25,7 +25,7 @@ public class P07_GenerowaneId {
String[] polaGenerowane = {"location_id", "state_province"}; String[] polaGenerowane = {"location_id", "state_province"};
String sql = "INSERT INTO locations(street_address, postal_code, city, country_id) VALUES(?, ?, ?, ?)"; String sql = "INSERT INTO locations(street_address, postal_code, city, country_id) VALUES(?, ?, ?, ?)";
try(Connection c = DriverManager.getConnection(Ustawienia.URL, Ustawienia.USER, Ustawienia.PASSWD); try(Connection c = DriverManager.getConnection(Ustawienia.URL, Ustawienia.USER, Ustawienia.PASSWD);
PreparedStatement stmt = c.prepareStatement(sql, polaGenerowane)) { PreparedStatement stmt = c.prepareStatement(sql, polaGenerowane)) {
stmt.setString(1, "Nowa z " + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:SS"))); stmt.setString(1, "Nowa z " + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:SS")));
......
...@@ -25,6 +25,9 @@ public class P11_Metadane { ...@@ -25,6 +25,9 @@ public class P11_Metadane {
wypiszTabele(tables); wypiszTabele(tables);
} }
System.out.println("\n\nNormalna tabela:"); System.out.println("\n\nNormalna tabela:");
// dbMetaData.getColumns(null, "public", null, null);
// dbMetaData.getPrimaryKeys(null, "public", null);
// dbMetaData.getFunctions(null, "public", null);
try(ResultSet rs = c.createStatement().executeQuery("SELECT * FROM jobs")) { try(ResultSet rs = c.createStatement().executeQuery("SELECT * FROM jobs")) {
wypiszTabele(rs); wypiszTabele(rs);
......
...@@ -28,7 +28,7 @@ public class P24_WebRowSet { ...@@ -28,7 +28,7 @@ public class P24_WebRowSet {
rowSet.execute(); rowSet.execute();
System.out.println("Eksportuję XML"); System.out.println("Eksportuję XML");
try(Writer out = new BufferedWriter(new FileWriter("employees.xml"))) { try(Writer out = new BufferedWriter(new FileWriter("out/employees.xml"))) {
rowSet.writeXml(out); rowSet.writeXml(out);
} }
System.out.println("Gotowe"); System.out.println("Gotowe");
......
...@@ -2,7 +2,8 @@ package p21_jdbc.postgresql; ...@@ -2,7 +2,8 @@ package p21_jdbc.postgresql;
public class Ustawienia { public class Ustawienia {
// public static final String HOST = "localhost"; // public static final String HOST = "localhost";
public static final String HOST = "vps-2bc225bd.vps.ovh.net"; // public static final String HOST = "vps-2bc225bd.vps.ovh.net";
public static final String HOST = "57.128.222.164";
public static final String PASSWD = "abc123vps"; public static final String PASSWD = "abc123vps";
public static final String BAZA = "hr"; public static final String BAZA = "hr";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment