A
A
Alik_Kolizeev2021-01-08 13:57:49
PostgreSQL
Alik_Kolizeev, 2021-01-08 13:57:49

I want to display data from a postgre sql table, but what's wrong?

I just want to display the id column from the users_id table like this

Statement st=conn.createStatement();

            ResultSet rs=st.executeQuery("select id from users_id");
            while(rs.next()){
                System.out.println(rs.getString("contry_id")+", "+rs.getString("country_name"));

ERROR:org.postgresql.util.PSQLException: ERROR: relation "users_id" does not exist

Here is a screenshot that all tables exist5ff83aec6a816547875015.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-01-08
@Alik_Kolizeev

As far as I remember from your previous question, you are connecting to the postgres database ( jdbc:postgresql://localhost:5432/postgres - the last member here means the name of the database), but you need to Drive_in.
jdbc:postgresql://localhost:5432/Drive_in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question