Generally we design report design files and we use external program to set data source connection properties. Since we need to install this resign files in multiple server locations and database settings are different for each server, we can not hard code the password and deliver the report design files. We have an external program which reads application configuration files and populates database connection settings in the report design files. This external program replaces the datasource driver class, database URL, user name, password and etc according to the application configuration. The following piece of code will be useful to find the base64 encoded form of password. Which can be used to replace the password which was set from the BIRT designer.
import org.apache.commons.codec.binary.Base64;
public class Base64Utils
{
public static void main(String[] args)
{
try
{
String clearText = "welcome";
String encodedText;
encodedText = new String(Base64.encodeBase64(clearText.getBytes()));
System.out.println("Encoded: " + encodedText);
System.out.println("Decoded: " + new String(Base64.decodeBase64(encodedText.getBytes())));
/*
******************************
OUTPUT
Encoded: d2VsY29tZQ==
Decoded: welcome
******************************
*/
}
catch (Exception e)
{
e.printStackTrace();
}
}
}