Updating datasources for multiple databases

Changes in the database.properties file require updates in the LPM portal application server. By default, the LPM portal is configured with datasources that are called the default and secondary datasources. Database information in the datasource varies on the LPM setup. For example, LPM installed in a non-serverless setup points the default and secondary datasources to the same database. In a serverless setup, the default datasource points to the LPM Microsoft SQL Server database, and the secondary datasource points to the LDD Firebird database.

  1. From Lexmark Management Console, set the application server offline.
  2. From the application server, browse to the <install_path> \apps\lpm\WEB-INF\classes folder, where <install_path> is the installation path of LPM.
  3. Using a text editor, open the database-production-config.properties file.
  4. Update the database information pointed by the default or secondary datasource.

    Sample code

    dataSource.url = jdbc:sqlserver://<ip address>;databasename=LPMPremise;?lc_ctype=UTF-8
    dataSource.driverClassName = com.microsoft.sqlserver.jdbc.SQLServerDriver
    dataSource.dialect = org.hibernate.dialect.SQLServer2008Dialect
    dataSource.username = lpmadmin
    dataSource.password = tiger123
    dataSource.properties.validationQuery = select 1
    dataSource.pooled = true
    dataSource.properties.maxActive = 15
    dataSource.properties.maxIdle = 1
    dataSource.properties.minIdle = 1
    dataSource.properties.minEvictableIdleTimeMillis=5000
    dataSource.properties.timeBetweenEvictionRunsMillis=60000
    dataSource.properties.testOnBorrow=true
    dataSource.properties.testWhileIdle=true
    dataSource.properties.testOnReturn=true
    dataSource.removeAbandoned=true
    dataSource.removeAbandonedTimeout=180000
    
    dataSource_secondary.url = jdbc:firebirdsql://<ip address>/3050:SOLUTIONINFO?lc_ctype=UTF-8
    dataSource_secondary.driverClassName = org.firebirdsql.jdbc.FBDriver
    dataSource_secondary.dialect = org.hibernate.dialect.FirebirdDialect
    dataSource_secondary.username = framework
    dataSource_secondary.password = ENC (mna6C4NkloGNVSx4ry08RA==)
    dataSource_secondary.properties.validationQuery = select 1 from RDB$DATABASE
    dataSource_secondary.pooled = true
    dataSource_secondary.properties.maxActive = 15
    dataSource_secondary.properties.maxIdle = 1
    dataSource_secondary.properties.minIdle = 1
    dataSource_secondary.properties.minEvictableIdleTimeMillis=5000
    dataSource_secondary.properties.timeBetweenEvictionRunsMillis=60000
    dataSource_secondary.properties.testOnBorrow=true
    dataSource_secondary.properties.testWhileIdle=true
    dataSource_secondary.properties.testOnReturn=true
    dataSource_secondary.removeAbandoned=true
    dataSource_secondary.removeAbandonedTimeout=180000
  5. To add another datasource, do the following:
    1. Copy the secondary datasource.
    2. Replace secondary with tertiary or any suffix that is appropriate and unique.
    3. Update the database information for the added datasource.
    4. Add the password encryption codec for the added datasource.

      Sample code

      dataSource_tertiary.url = jdbc:firebirdsql://<ip address>/3050:SOLUTIONINFO?lc_ctype=UTF-8
      dataSource_tertiary.driverClassName = org.firebirdsql.jdbc.FBDriver
      dataSource_tertiary.dialect = org.hibernate.dialect.FirebirdDialect
      dataSource_tertiary.username = framework
      dataSource_tertiary.password = ENC (mna6C4NkloGNVSx4ry08RA==)
      dataSource_tertiary.properties.validationQuery = select 1 from RDB$DATABASE
      dataSource_tertiary.pooled = true
      dataSource_tertiary.properties.maxActive = 15
      dataSource_tertiary.properties.maxIdle = 1
      dataSource_tertiary.properties.minIdle = 1
      dataSource_tertiary.properties.minEvictableIdleTimeMillis=5000
      dataSource_tertiary.properties.timeBetweenEvictionRunsMillis=60000
      dataSource_tertiary.properties.testOnBorrow=true
      dataSource_tertiary.properties.testWhileIdle=true
      dataSource_tertiary.properties.testOnReturn=true
      dataSource_tertiary.removeAbandoned=true
      dataSource_tertiary.removeAbandonedTimeout=180000
      dataSource_tertiary.passwordEncryptionCodec=com.lexmark.utils.PBEWithMD5AndDESCodec
  6. If a new datasource is added, then from the application server, browse to the <install_path> \apps\lpm\WEB-INF\classes folder, where <install_path> is the installation path of LPM.
  7. Using a text editor, open the app-production-config.properties file.
  8. Update the database information that must point to the tertiary datasource.

    Sample code

    datasource.webapp = secondary
    datasource.badge = DEFAULT
    datasource.pin = tertiary
    datasource.stats = DEFAULT
    datasource.printernicknames = secondary
    datasource.printtrackdevices = DEFAULT
  9. Make sure that the updates in the LPM portal are the same as the values in the database.properties file.
  10. Save the file.
  11. Restart the Lexmark Solutions Application Server service.