[xwiki-devs] [Proposal] Add support for PostgreSQL
Hello, Postgres works quite well with XWiki as it is (I use it on localhost without issue). The only feature missing right now is virtual wiki support, this is because Hibernate demands that everything take place inside of a transaction and Postgres demands that databases be created outside of a transaction. Recently I have found that I can open a single connection and switch it to "autoCommit" mode create a database then close the session. A test case: {{groovy}} session = xcontext.getContext().getWiki().getHibernateStore().getSessionFactory().openSession(); connection = session.connection(); try { connection.setAutoCommit(true); statement = connection.createStatement(); statement.execute("create database subwiki"); } finally { connection.setAutoCommit(false); session.close(); } {{/groovy}} I am proposing we add a method to XWikiHibernateStore: executeWithAutoCommit(String sql) which does what is shown in the above code. This should open the door to postgres support. WDYT? Caleb
On Sat, Mar 13, 2010 at 04:15, Caleb James DeLisle <[email protected]> wrote:
Hello,
Postgres works quite well with XWiki as it is (I use it on localhost without issue). The only feature missing right now is virtual wiki support, this is because Hibernate demands that everything take place inside of a transaction and Postgres demands that databases be created outside of a transaction. Recently I have found that I can open a single connection and switch it to "autoCommit" mode create a database then close the session.
A test case: {{groovy}} session = xcontext.getContext().getWiki().getHibernateStore().getSessionFactory().openSession(); connection = session.connection(); try { connection.setAutoCommit(true); statement = connection.createStatement(); statement.execute("create database subwiki"); } finally { connection.setAutoCommit(false); session.close(); } {{/groovy}}
I am proposing we add a method to XWikiHibernateStore: executeWithAutoCommit(String sql) which does what is shown in the above code.
This should open the door to postgres support.
WDYT?
+1
Caleb
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
At the moment it looks like a false alarm. Postgres still does not support setCatalog, the only way to change databases is to open a new connection, and using schemas causes duplicate key errors when activitystream tries to save an event in the local wiki then save the same event in the main wiki. When I get a chance I will try opening new connections to switch databases. Caleb Thomas Mortagne wrote:
On Sat, Mar 13, 2010 at 04:15, Caleb James DeLisle <[email protected]> wrote:
Hello,
Postgres works quite well with XWiki as it is (I use it on localhost without issue). The only feature missing right now is virtual wiki support, this is because Hibernate demands that everything take place inside of a transaction and Postgres demands that databases be created outside of a transaction. Recently I have found that I can open a single connection and switch it to "autoCommit" mode create a database then close the session.
A test case: {{groovy}} session = xcontext.getContext().getWiki().getHibernateStore().getSessionFactory().openSession(); connection = session.connection(); try { connection.setAutoCommit(true); statement = connection.createStatement(); statement.execute("create database subwiki"); } finally { connection.setAutoCommit(false); session.close(); } {{/groovy}}
I am proposing we add a method to XWikiHibernateStore: executeWithAutoCommit(String sql) which does what is shown in the above code.
This should open the door to postgres support.
WDYT?
+1
Caleb
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Caleb James DeLisle -
Thomas Mortagne