relation "cat" does not exist
表明Cat表不存在testHibernate 这个是数据库吧
里面有你要的表吗还有看看数据库里面设置的权限有没有问题

解决方案 »

  1.   

    <%@ page contentType="text/html;charset=Shift_JIS"%>
    <%@ page import="java.sql.*"%>
    <html>
    <body>
    <%Class.forName("org.postgresql.Driver");
    String url ="jdbc:postgresql://localhost:5432/testHibernate";
    String user="postgres";
    String password="postgres";
    try{
    Connection conn= DriverManager.getConnection(url,user,password);
    Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
    String sql="select * from CAT";
    ResultSet rs=stmt.executeQuery(sql);
    while(rs.next()) {%>
    First Field:<%=rs.getString(1)%>
    Second Field:<%=rs.getString(2)%>
    <%}%>
    <%out.print("success!!!");%>
    <%rs.close();
    stmt.close();
    conn.close();
    }catch(Exception ex)
    {
     ex.printStack();
    }
    %>
    </body>
    </html>
    !--这样可以抛出更详细的错误吧
      

  2.   

    建立testHibernate 數據庫,添加cat表.
    要麼試試連接池
    <?xml version="1.0" encoding="UTF-8"?><datasources>
      <local-tx-datasource>
        <jndi-name>jdbc/quizDS</jndi-name>
        <connection-url>jdbc:postgresql://127.0.0.1:5432/quiz?useUnicode=true&amp;characterEncoding=Big5</connection-url>
        <driver-class>org.postgresql.Driver</driver-class>
        <user-name>postgres</user-name>
        <password>17909</password>    <!--pooling parameters-->
        <min-pool-size>5</min-pool-size>
        <max-pool-size>100</max-pool-size>
        <blocking-timeout-millis>5000</blocking-timeout-millis>
        <idle-timeout-minutes>15</idle-timeout-minutes>  </local-tx-datasource>
    </datasources>
      

  3.   

    我自己解决了,是postgreSQL表名要小写的缘故,真的很奇怪的,还是要谢谢大家!!!