Pytania w komentarzach, zainstalowalam PostgreSQL 9.1, tam sterownik bazy podobno sie zainstalowal, pracuje pod windows xp
z gory dzieki za pomoc
oto fragmenty mojego kodu:
try {
Class.forName("org.postgresql.Driver"); //czy to ma tak zostac u mnie ?
} catch (ClassNotFoundException cnfe) {
System.out.println("Couldn't find the driver!");
System.out.println("Let's print a stack trace, and exit.");
cnfe.printStackTrace();
System.exit(1);
}
Connection c = null;
try {
String dbaseURL = "jdbc:postgresql://localhost/korek"; //jaka mam dac sciezke dostepu do sterownika, jak to sprawdzic ?
String username = "korek"; //jaka nazwa uzytkownika, przy instalacji podawalam tylko haslo
String password = "secret";
c = DriverManager.getConnection(dbaseURL, username, password);
} catch (SQLException se) {
System.out.println("Couldn't connect: print out a stack trace and exit.");
se.printStackTrace();
System.exit(1);
try {
Statement st = c.createStatement();
ResultSet rs = st.executeQuery("SELECT konto,imie FROM spn_2002");
while (rs.next()) {
String konto = rs.getString("konto");
String imie = rs.getString("imie");
System.out.print("Columns returned ");
System.out.println(konto + " " + imie);
}
rs.close();
st.close();
} catch (SQLException e) {
System.out.println("Blad podczas przetwarzania danych:" + e);
Logger.getLogger(OnisSaveDoBazy.class.getName()).log(Level.SEVERE, null, e);
}
}