I have linked JDBC with PostgreSQL. How do we create a view with a placeholder?
But I get this error:
SQL Exception.: ERROR: there is no parameter $1 Position: 72
queryString = "CREATE VIEW clients AS (SELECT client_id FROM Client WHERE firstname = ?)";
pStatement = conn.prepareStatement( queryString );
System.out.println("Enter the name of a client");
br = new BufferedReader( new InputStreamReader(System.in) );
String client_name = br.readLine();
pStatement.setString(1, client_name);
pStatement.executeUpdate();
The last line (pStatement.executeUpdate();
) causes an exception. Why?