• Dynamic username password in jdbc file

    By Sachin Kulkarni 5 years ago

    Is there a way to dynamically compute username and password in the jdbc connection file instead of hardcoding it in the .jdbc file which is kept under WebContent/WEB-INF folder ?

    • By B Gleeson 5 years ago

      It's not currently supported, but it's a feature we are hoping to add in the future.

      In the meantime, you could take a look at this blog post where the author has sub-classed JdbcConnectionManager in order to handle dynamic username and password values: http://lazynotesguy.net/blog/2013/08/09/subclassing-an-extlib-component/

      • By Sachin Kulkarni 5 years ago

        Thank you for the pointer. I have checked it, and it helps.

        I would like to know how can we use the ConnectionManager when we execute queries passing connection object.

        eg: var results:java.sql.ResultSet =@JdbcExecuteQuery(con,“SELECT * FROM employees WHERE ACTIVE=’Y’”);

        I have asked the same query on his blog post too. Any ideas would be highly appreciated.

        • By B Gleeson 5 years ago

          Passing a ConnectionManager instance to the jdbc @functions is not supported I'm afraid.
          You can only pass in a String name for the connection you wish to use

          You could instead create a jdbcQuery data source with the query you have listed there. The data source can use a ConnectionManager instance

          • By Sachin Kulkarni 5 years ago

            Thank you Gleeson,

            I have used JDBC RowSet as a datasource in a panel and able to fetch the row values using the below peice of code in ComboBox.


            var count=jdbcRowSet1.getCount();
            var list=new java.util.ArrayList();

            I would like to know what are all the properties/methods we can use with jdbcRowSet1 or jdbcQuery.
            Currently i have used getRow, getCount.. are there any other methods ? can we get some documentation of all of it somewhere please?

            Similar question was asked before from someone:http://www.openntf.org/main.nsf/project.xsp?r=project/XPages%20Extension%20Library/discussions/C6459BC9402E579D86257B39004411DC

            • By B Gleeson 5 years ago

              You could access the source code in the extension library to investigate what methods are available. For example, in the most recent release, you could find the source code for jdbcRowSet here:

              Alternatively for jdbcQuery, see JdbcDataBlockAccessor.java in the same directory

              • By Sachin Kulkarni 5 years ago

                Thank you so much, its helpful.