2 Replies Latest reply on Jul 18, 2007 7:02 PM by kukeltje

    how to programatically set jdbc connection string for hsqldb

    tjcroteau

      Hi,

      I am very new to jbpm and trying to programatically set the hsdqldb connection string instead of using the defaults set in hibernate.cfg.xml. All of the defaults in the hibernate config file are acceptable with the exception of the jdbcconnection string (I need to construct the location of the database at runtime).

      I'm using the below code where connection is a javax.sql.Connection that has been populated with the jdbc connection string.

      JbpmContext jbpmContext = Jbpmconfiguration.getInstance().createJbpmContext();
      jbpmContext.setConnection(connection);
      


      I thought that interjecting the setConnection into the context would override the jdbc connection string that is in the hibernate.cfg.xml file (based upon the jbpm chapter on persistence). However, the jbpm instance that is starting up is still using the jdbc connect string from the config file instead of the one that is passed into setConnection.

      I would appreciate any help or thoughts.

      Tammy

        • 1. Re: how to programatically set jdbc connection string for hs
          tjcroteau

          So, I have found that the only jbpm call that disregards the db connection that was set on the context using JbpmContext.setConnection is the call to createSchema.

          If the connection is set on the context when createSchema is called a UserSuppliedConnectionProvider exception is thrown with the message "The user must supply a JDBC Connection"

          This appears to be a bug in jbpm not passing the connection down to hibernate.

          As a workaround, I found that setting the property hibernate.connection.url will force hibernate to find the database connection that was already established.

          • 2. Re: how to programatically set jdbc connection string for hs
            kukeltje

            please file a jira issue for this and better yet, attach a proposed patch.