importPackage( Packages.java.io,Packages.java.util );
dbConfigPath = reportContext.getClass().getResource("/dbConifg.properties").getPath();
fin = new java.io.FileInputStream(dbConfigPath);
props = new java.util.Properties();
props.load(fin);
odaURL = new String(props.getProperty("url"));
odaUser = new String(props.getProperty("username"));
odaPassword = new String(props.getProperty("password"));
if(odaURL != null)
{
this.setExtensionProperty("odaURL",odaURL);
}
if(odaUser != null)
{
this.setExtensionProperty("odaUser",odaUser);
}
if(odaPassword != null)
{
this.setExtensionProperty("odaPassword",odaPassword);
}
fin.close();
点击数据源节点,选择脚本。在beforeOpen实践中写入以上代码!
本文详细介绍了如何导入Java包、配置数据库连接属性,并在脚本中实践配置过程,适用于初学者理解数据库配置的基本步骤。
1810

被折叠的 条评论
为什么被折叠?



