蔭試圖連接與posgres硒和下面的錯誤硒與PostgreSQL的顯示
FAILED: selectQuery org.postgresql.util.PSQLException: ERROR: relation "login" does not exist
我的代碼如下
package Posgress;
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;
import org.testng.annotations.Test; @Test public class PosgressTest { public static void selectQuery() throws SQLException, ClassNotFoundException {
//Load MySQL JDBC Driver Class.forName("org.postgresql.Driver"); Connection connection = null; connection = DriverManager.getConnection( "jdbc:postgresql://localhost:5432/DIC","postgres", "root"); Statement st = connection.createStatement(); System.out.println("Connection"); String selectquery = "Select * from Login"; System.out.println("Connection1"); //Executing the SQL Query and store the results in ResultSet ResultSet rs = st.executeQuery(selectquery); //While loop to iterate through all data and print results while (rs.next()) { System.out.println(rs.getString("username")); System.out.println(rs.getString("password")); } //Closing DB Connection connection.close(); } }
我有一個表「登錄內部架構「DICschema」。我寫的選擇這樣的查詢還從「選擇DICschema.Login *」,那麼也同樣的錯誤
我給這樣也「從DICschema.Login選擇*」 .Same錯誤我 – Vishnu
是否Postgres的用戶可以訪問DICschema? – pesky
如何讓previllages訪問架構給用戶? – Vishnu