我有一個Postgres數據庫和一個名爲「state_master」表。我只是通過下面的代碼從這個表中獲取數據。數據庫錯誤:關係不存在
import java.sql.*;
public class Test1
{
public static void main(String... s1)
{
try{
Class.forName("org.postgresql.Driver");
Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432:secc_db","postgres", password");
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("Select * from state_master");
}catch(SQLException e){ System.out.println(e);}
catch(Exception i){System.out.println(i);}
}
}
我得到的只是一個錯誤:relation state_master does not exist
。請幫我解決這個問題。
請的方式,更容易閱讀的格式代碼。 – 2012-03-19 05:22:30