witam. chce sie połączyć z baza danych za pomoca javy. baza jest w postgresql. pokazuje mi taki błąd:
type Status report
message /pjojekt/DataBase
description The requested resource (/pjojekt/DataBase) is not available.
A tu mój kod do połączenia. co jest nie tak?
import java.sql.*;
public class DataBase
{
public static void main( String[] args ) {
try {
String url = "jdbc:postgresql://localhost/pjojekt";
String user = "postgres";
String password = "13757";
Class.forName( "org.postgresql.Driver" );
Connection conn = DriverManager.getConnection( url, user, password );
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery( "SELECT * from materialy" );
while ( rs.next() ) {
System.out.println( rs.getString( "materialy" ) );
}
rs.close();
} catch ( Exception e ) {
e.printStackTrace();
}
}
}