cancel
Showing results for 
Search instead for 
Did you mean: 

How to access Std. Portal database table (WCR_USERSTAT)..?

former_member261631
Participant
0 Kudos

Hi Experts,

How to access the Std portal databse tables like WCR_USERSTAT table using webdynpro java, PortalComponent application.

I have come across the SAP Code gallery for the same:


http://wiki.scn.sap.com/wiki/display/Snippets/Direct+Access+Databse+Tables

But in the code need to lookup portal DataSource by alias name and here given Std alias name is not working.....

Like to know any other option to access the Std. SAP Portal databse tables.

Regards,

Hanif

Accepted Solutions (0)

Answers (1)

Answers (1)

vdurgarao09
Contributor
0 Kudos
former_member261631
Participant
0 Kudos

Hello Durga,

Thanks for the reply.

But as mentioned, I am using the Example-Activity Report for finding out an user's last logon time on the portal

from the link you shred and here the code does not execute the query and shows blank.

Need to know what could the jdbc DataSource object alias name and from  where to ensure the same, as then only system will have active connection object subsequently query will get execute.

Let me know whether above helped to execute the query...?

Regards,

Hanif

vdurgarao09
Contributor
0 Kudos

Hi,

Check this code once may help for you.

sqlStatement = "select TIMESTAMPHOUR,LOGONID from WCR_USERSTAT ORDER BY TIMESTAMPHOUR DESC ";

  InitialContext initialContext = new InitialContext();

  dataSource = (DataSource) initialContext.lookup("jdbc/SAP/BC_UME");

// Default  Datasource created at installation  time

BR,

Durga.

former_member261631
Participant
0 Kudos

Hi Durga,

I have used the code in web-dynpro java program to access the WCR_USRSTAT table, but no data is getting accessed.

Whereas by using the same code in portal application component, the data is acessible.

Like to know what is limiting the webdynpro to pull the data from WCR tables.

Regards,

hanif

vdurgarao09
Contributor
0 Kudos

Hi,

Sorry for the long silence.In this WDJ code may be help for you.


String loginsRecord = "select logonid,timestamphour from WCR_USERSTAT where timestamphour between "+<FROMDATE>+" and "+<TODATE>+" " +

  "and (logonid <> 'Administrator' and logonid <> 'Guest' and logonid <> 'admin') and USERTYPE <> 'a' order by timestamphour desc";

  pstm = con.prepareStatement(loginsRecord);

  ResultSet rs = pstm.executeQuery();

Here you will get the table of data in ResultSet rs.You can set the table node and display.

BR,

Durga Rao.

former_member261631
Participant
0 Kudos

Hi Durga,

Sorry again from my side on the response.

But the above query does not populate any data in web-dynpro java framework.

Regards,

hanif