刚接触Cognos,被权限和单点登陆搞得焦头烂额,记录下处理步骤。2021-12-31
- 建表:注意,USERID decimal,示例为int,
CREATE TABLE USERS(USERID decimal NOT NULL, USERNAME VARCHAR(255) NOT NULL,
PASSWORD VARCHAR(255) NOT NULL, FULLNAME VARCHAR(255) NULL,
EMAIL VARCHAR(255) NULL, LOCALE CHAR(5) NULL,
TENANT VARCHAR(128) NULL, PRIMARY KEY(USERID));
CREATE TABLE GROUPS(GROUPID decimal NOT NULL, GROUPNAME VARCHAR(255) NOT NULL,
USERID decimal NULL, TENANT VARCHAR(128) NOT NULL);
CREATE VIEW OBJECTVIEW AS
SELECT USERID AS ID, USERNAME AS USERNAME, FULLNAME AS NAME, TENANT AS TENANT,
1 AS ISUSER, 0 AS ISGROUP
FROM USERS
UNION
SELECT GROUPID AS ID, NULL AS USERNAME, GROUPNAME AS NAME, TENANT AS TENANT,
0 AS ISUSER, 1 AS ISGROUP
FROM GROUPS;
- 编译示例代码,JDBCSample.jar(直接编译即可),放在$安装路径$/webapps/p2pd/WEB-INF/lib
- 配置文件JDBC_Config_Sample1.properties,JDBC_Config_Restorable.properties,放在$安装路径$/configuration
#For Microsoft SQL Server connections #connectionString=jdbc:sqlserver://#server#:#port#;databaseName=#databasename# #driverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver #username=#user# #password=#password# #singleSignon=true
- Cognos配置,身份验证,右键添加,如下图(Cognos下的匿名登陆设置false):
- 管理控制台设置参数: 安全性->URL 中允许的登录参数
- 浏览器带参数登陆:
http://localhost:9300/bi/?perspective=home&CAMUsername=admin&CAMPassword=admin