2013-05-31 26 views
2

我正面臨着iBatis和PostgreSQL模式的問題。 當我使用公共架構時,我不會遇到任何問題。一切工作對我很好。在iBatis中使用postgreSQL模式

我的URL連接字符串就像下面:

jdbc:postgresql://127.0.0.1:5678/dbname 

但是當我試圖使用不同的模式來使用同一數據庫中,我總是得到

com.ibatis.common.jdbc.exception.NestedSQLException: 
--- The error occurred in SqlMapProcessedFiles.xml. 
--- The error occurred while applying a parameter map. 
--- Check the getProcessedFiles-InlineParameterMap. 
--- Check the statement (query failed). 
--- Cause: java.sql.SQLException: ERROR: relation "table name" does not exist 

我的網址連接字符串看起來像如下:

jdbc:postgresql://127.0.0.1:5678/dbname?searchpath=schemaName 

我在使用ibatis-2.3.4.726.jar和postgresql-8.0-325.jdbc2。罐。

由於提前,

問候,

+1

PG JDBC驅動程序不允許您指定的搜索路徑,你必須先連接,然後將其設置:http://stackoverflow.com/questions/4168689/is-it-possible-到指定-架構時,連接到Postgres的-與-JDBC –

回答

1

定義連接屬性如下:

  • 連接網址:jdbc:postgresql://localhost:5432/postgres,使
  • 配置在postgres數據庫屬性的search_path和如show所示定義search_path變量。

Sample View