我正在使用pgAdmin3並使用pkg安裝postgreSQL和第 我試圖通過tomcat連接到postgreSQL當我做./startup。從我的tomcat/bin目錄中的日誌文件SH顯示了這個錯誤:錯誤檢測數據庫類型:無法創建PoolableConnectionFactory(致命:沒有pg_hba.conf
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metaModelDAO' defined in class path resource [applicationContext-coreDataServices.xml]: Invocation of init method failed; nested exception is org.apache.cayenne.CayenneRuntimeException: [v.3.0.1.LB Nov 16 2011 05:24:11] Error detecting database type: Cannot create PoolableConnectionFactory (FATAL: no pg_hba.conf entry for host "10.0.0.197", user "abc_writer", database "abc", SSL off)
以下是我在我的context.xml:
<Context>
<Resource username="abc_writer" password="levelsbeyond"
url="jdbc:postgresql://localhost:5432/abc"
type="javax.sql.DataSource" name="jdbc/abc-workflow"
maxWait="10000" maxIdle="20" maxActive="50"
driverClassName="org.postgresql.Driver" auth="Container" />
</Context>
這裏是我的pg_hba.config的樣子:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres md5
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
host abc abc_writer 10.0.0.197 md5
當我從PostgreSQL的/ bin中開拓郵政局長它讀取此:
localhost:~ bryanraymond$ /Library/PostgreSQL/9.3/bin/postgres ; exit;
postgres cannot access the server configuration file
"/Library/PostgreSQL/9.3/data/postgresql.conf": Permission denied
logout
但願它說我有pg_hba.conf中的條目是因爲我沒有權限,如果這樣怎麼做的原因我獲得許可?如果這不是問題,我是否有設置錯誤?
---謝謝你,布萊恩
當你運行'psql -h localhost -U abc_writer -d abc'時會發生什麼? –
我得到這個:localhost:〜bryanraymond $ psql -h localhost -U abc_writer -d abc psql(9.1.9,server 9.3.0) 警告:psql版本9.1,服務器版本9.3。 某些psql功能可能無法正常工作。 輸入「help」尋求幫助。 abc =# – user2864917