Just getting into the development cycle / learning curve here with xpages. I am trying to do a @Dblookup to a database on another server. All the examples I have seen to date have lookups to data on the same server or in the same database. Am I running into a limitation or missing something? I thought it originally had something to do with the trusted servers setting on the server document. The trusted servers setting on my server document includes all the servers in my development/test environment. Still no luck. Temporary solution is to use the database on the same server, however, this won’t likely work as a permanent solution.
Any thoughts or next steps would be appreciated.
Colin.
Subject: Code?
Can you post the code that you’re using? And any error message?
Subject: Xpages to another server.
var sDbKey = “keyvalue”; var sServer = @DbLookup(@DbName(),“vwLUApplicationLinksByName”,sDbKey,“ApplicationServerTX”);
var sFile = @DbLookup(@DbName(),"vwLUApplicationLinksByName",sDbKey,"ApplicationFilePathTX");
var directory:NotesDatabase = session.getDatabase(sServer,sFile,false);
if (directory ==null){
var directory2:NotesDatabase = session.getDatabase(session.getServerName(),sFile,false);
if(directory2==null){
}
else{
directory = directory2;
}
}
else{
}
if (directory.isOpen()){
}
else{
var theval = directory.open();
}
Without using second if statement, I am unable to gain access to the database/data. So this results in accessing the database on the same server as the current application. The ApplicationServerTX = full canonical name of the server and the ApplicationFilePathTX = the path to the application database Directory/DBName.nsf.
Subject: Suggestions
There are two things that I would check here:
-
Make sure that you have access to the second server. For example if you are accessing the Xpage under the anonymous ACL then does anonymous have access to this second server?
-
Print out what is being returned as the server name and database name to make sure that it is returning the expected data. Perhaps you are getting back data that doesn’t resolve to a valid db name or path.
Subject: Response to suggestions
-
Anonymous access is set to read only which should be sufficient to get the @DbLookup.
-
db name and path match up to the database I wish to do the @dbLookup including the \ for the path as the database is not in the root of the data directory but in a subdirectory.
Trusted servers include the other server still stumped on this one. Code is running from a JS server side script library instead of directly in the Suggestions of the typeahead area on the Xpage.