3
votes

I need to access WEB-INF files content in Lotus Notes database by using Java or Lotus Script: WebContent\WEB-INF\jdbc\DB2Connect.jdbc

XPages are using these properties to connect DB2 database. But I need a Java agent that would use same properties in DB2Connect.jdbc file (user name/password) to connect DB2 and do some routine task.

enter image description here

1
Could you use a file resource instead which would be accessible from both?Steve Zavocki
How can I use file resource to declare DB2 connection for XPage? I would use WEB-INF source.VladP
I am only suggesting that it is possible, I have never done this. For XPages only web-inf is best, but if you need to share the file then something inside the NSF will be accessible to the agent. I am guessing that you can write similar java (as your agent) to read the file and write the values to a scoped variable for XPages use.Steve Zavocki

1 Answers

1
votes

You can't access files within the nsf from an Java agent.

An Java agent lives in it's own "world". It has included all Java classes, Java archives, Java libraries and all resources.

You could probably access the file via http.

It might be easier though to just copy this one file into the agent's resource folder with "Import / Resource". You would access the file with

 InputStream is = this.getClass().getResourceAsStream("/DB2connect.jdbc");