Archives for the ‘853 Extension Library’ Category

18 Sep 2012
3

TUTORIAL: Integrating XPages with DB2 – Part 2

Hi everyone. So, just 2 things firstly:

1. This is an extended Post to David Leedy’s NotesIn9 Posting of “Intro to XPages and Relational Data – Part 2“.

2. I do apologize that this took a while to publish. This is one of the more challenging years to find some free time to contribute to the Domino and XPages community. Having said that, I have quite a few Video Tutorials planned before this year ends, so stay tuned :)

 

Now that that’s out the way…..this post is Part 2 to the “Integrating XPages with DB2 – Part 1“. In this Video I show you how to Create/Read/Update/Delete DB2 Data using XPages. More importantly, I show you how to empower the User to perform all these functions via a User Interface. It’s usually easy to write this logic in the back-end, but a little more involved when handing that power over to the User.

 

The good news is that it’s fairly straightforward. I show you some quick functions that will get you up and running in no time. As I explained in the Video though, there are much more advanced ways of integrating to DB2. This will involve some knowledge of DB2 itself. The keyword is…..”Stored Procedures“. This is where the power lies. A Stored Procedure is very much like a Sub Routine in LotusScript or a Function in Java or JavaScript, but you code in SQL Language. You can pass the Stored Procedure parameters, have all your logic neatly set out in a central place in DB2 and return values from the Stored Procedure which will allow you do things like create Child Documents, etc.

Later on in the near future, I will think up a straightforward Tutorial which will show you how this all works.

I hope you enjoy this Video. I really enjoyed making it. It was one of my smoothest recordings where everything went right the first time.

I want to thank David Leedy as always for adding this to his NotesIn9 Series. You da man :)

Cheers.

John

 

IMPORTANT NOTE: If you are not able to view this Video in HD, please Click Here to open this video up in a different Player.

20 Jul 2012
4

A quick example of the Dynamic Content & Data View Controls used in an XPages App

Hi Everyone. I’ve finally made some time to test out a few features from the XPages Extension Library. It was a bit of a learning curve, but it’s looking good.

Click here to view a Demo of these Controls.

I apologize in advance if there’s a small delay when using this App. It’s been hosted on a Server in South Africa…so the Internet Line is to blame.

Anyways…below is a list of Controls I’m using in the XPages App:

1. On top you’ll see the XPages Debug Control that was created by Mark Leusink and is available on OpenNTF. It’s very cool in the sense that it allows you to print messages directly to the Control and not via the Server Console. It also allows you to see all Scoped Variables that are being used in the XPage. Finally, it has an awesome feature where you can execute SSJS Scripts and view the result. I am very happy with this Control.

2. I’m using the Application Layout to control the Look and Feel of the XPage. It’s always a massive time saver. Click here to view the Video from NotesIn9 that explains the Application Layout in more detail.

3. in the Left Section I’m using the Navigation Control made available in the XPages Extension Library. This was a trick and a half, but I managed to use Partial Refreshes for all my onclick events. This allows me to use 1 XPage and multiple Custom Controls.

4. Depending on loading time, you might see the XPage go into Standby during the Partial Refresh. This is thanks to the Standby Custom Control which is available for download from OpenNTF. This is an awesome feature that needs no additional resources to function.

5. I have 2 views in the Main Content Section. These are Data Views that I am using from the XPages Extension Library. It’s safe to say that I am currently using very basic functionality from the Data View. There’s a lot more that you can do with it.

6. The 2 Data Views exist in a Dynamic Content Control, also from the XPages Extension Library. I won’t go into too much detail about this except that the Dynamic Control keeps your XPage light, and only loads Controls when they are needed. Very awesome stuff.

I am quite happy with what I’ve achieved in the last 3 hours. I had to put a few hacks in place to make everything work with Partial Refreshes, but all in all it was quite easy to implement.

I highly recommend the XPages Extension Library Book. It’s a life saver.

Till next time. Enjoy :)

4 May 2012
10

XPages TIP: What to check when Domino doesn’t install OSGI plugins from UpdateSite

Hi everyone.

So, yesterday I faced a doozy. We wanted the XPages Extension Library installed on one of our Client’s Servers using the UpdateSite that ships with Lotus Domino 8.5.3. Interestingly enough, no matter what we tried, it just wouldn’t install.

 

FIRST THINGS FIRST

In order to use the UpdateSite to deploy OSGI plugins, you’ll need to do the following:

1. Create a Database called “Whatever UpdateSite” in the Domino Data Directory, using the UpdateSite Template that ships with the Lotus Domino 8.5.3 Server.

2. In the Domino Server’s notes.ini, add the following ini Variable:

OSGI_HTTP_DYNAMIC_BUNDLES=yourupdatesitefilename.nsf

3. In the UpdateSite Database, import your OSGI Plugins.

4. Restart the Domino Server. (Note: A Server restart is only required if you modified the notes.ini. Other than that, a Restart Task HTTP will do the trick).

5. During the restart of the HTTP Task, you should see at some point a message along the lines of installing OSGI plugins. If you don’t see this message, then it’s not working.

 

BACK TO THE MATTER AT HAND

If you’ve done everything mentioned above, and the Server still won’t install the OSGI plugins, then the problem most likely lies with the Security settings for the specific Domino Server. When you import the OSGI Plugins into the UpadateSite database, the System automatically performs a Signing of all the Imports that took place. This means that it will sign the Imported Profiles with your current Lotus Notes ID.

So, it’s important that your Notes ID has access to perform XPages based operations on that Specific Server. To confirm this, do the following:

1. In the Domino Server’s Address Book, navigate to the All Server Documents view, and open the relevant Server Document (Note: You’ll need some Admin Access to perform these operations)

2. Click on the Edit Server button.

3. Navigate to the Security Tab.

4. In the Top right section of the Security Tab, you’ll see a field called “Sign agents or XPages to run on behalf of the invoker:“. If this field is empty, then every signature will be authorized on that Server as a default. Otherwise, you’ll need to be part of the list either as a User or as part of a Group. If the list is not empty and you are not featured in any way, the OSGI Plugins will NOT be installed.

 

That should do the trick. I don’t know of any other reason that the OSGI plugins won’t install from the UpdateSite Database.

Until next time…happy coding.

 

Cheers,

John

29 Feb 2012
19

TUTORIAL: Integrating XPages with DB2 – Part 1

Hi everyone. I’m happy to announce a Video Tutorial where I explain how to integrate one’s XPages Application with DB2 directly, and not through back-end Forms and Views.

The trick here is to have a bit of JDBC understanding, as well as a basic understanding of Relational Databases and SQL Query.

To work with this Video Tutorial, you’ll need to have the following in place:

1. An installed version of DB2. This can be DB2 Express as well, which is free – Click here to download.

2. An installed version of Domino Designer 8.5.3. I tested everything on my Domino Server, but there’s no reason why this shouldn’t work using your local HTTP session for Domino Designer – Click here to download.

3. An UpdateSite to install OSGI Plugins on Domino Server. NOTE: The UpdateSite database gets used for Domino Servers, and will not work for your local environment. To test everything using your Local HTTP, you’ll need to install the OSGI Plugins manually. You do this by extracting the contents of the Plugins Zip File to the Notes Data Directory, under “domino/workspace/applications/eclipse” folder.

 

Click here to view the Tutorial on how to setup the UpdateSite database and deploy OSGI Plugins on your Domino Server.

 

4. With reference to point number 3, Install the XPages Extension Library and JDBC Driver Plugins.

Download XPages Extension Library

Download JDBC Driver

 

5. Once you’ve deployed your plugins to your Domino Server, you can type in the following Commands to check if the Plugins were installed properly:

XPages Extension Libary:

tell http osgi ss com.ibm.xsp.extlib

JDBC DB2 Plugin:

tell http osgi ss extlib.driver.db2

The Domino Server should return information relating to the plugins you installed.

 

6. Here’s a copy of the Code that needs to be added to the db2.jdbc file that I speak about in the Video

<jdbc>
<driver>com.ibm.db2.jcc.DB2Driver</driver>
<url>jdbc:db2://localhost:50000/TESTDEMO</url>
<user>db2admin</user>
<password>password123</password>
</jdbc>

 

7. Here’s a copy of the Code that I use in the Video to add/remove/update and delete data in DB2

var mydata = {
FIRST_NAME: “John”,
LAST_NAME: “Jardin”
}

@JdbcInsert(“db2″,  “JJARDIN.USERPROFILES”, mydata)
var mydata = {
FIRST_NAME: “Sean”,
LAST_NAME: “Smith”
}

@JdbcUpdate(“db2″, “JJARDIN.USERPROFILES”, mydata, “ID=?”,1)
@JdbcDelete(“db2″,”JJARDIN.USERPROFILES”,”ID=?”,1)

 

I trust you will enjoy this Video. A Big thanks to David Leedy for making the video part of his NotesIn9 Series, and congrats once again on his recent milestone of 100 000 Views.

Also, another Big Thanks to the Domino and XPagees community, for always been available to assist wherever help is needed.

 

STAY TUNED FOR PART 2 OF XPAGES AND DB2 INTEGRATION!!!

 

25 Nov 2011
12

Integrating XPages with DB2 is just too easy

I presented a 3 Day Introduction to XPages Course this week for one of my clients, and they challenged me to have XPages connect to a DB2 environment they had set up. I must be honest I was a touch nervous as this would be my first time attempting this period.

I told the client that we would spend the last day (T0day) focusing on this particular challenge, and then also show them how the Application Layout Custom Control works.

We started around 7:00am this morning, and by 8:15am, we had a View Panel with 1 column displaying data from a DB2 table. Here’s the best part…..we got it right on our FIRST TRY.

Now, I have to make mention and take my hat off to my client for providing me with all the DB2 resources I needed to make the JDBC Data Source work, which included:

1. JDBC Jar Files which were placed in the Domino Directory under the folder “jvmlibext”

2. The URL to the DB2 Database that we planned on using

3. The Class name of the JDBC DB2 Driver

Using this Video from Niklas Heidloff as a reference, as well as perusing the JDBC NSF that ships with the 853 XPages Extension Library, we were able to configure a .jdbc file in our Database’s Package Explorer, create a View Panel in our XPage, map it to a JDBCQuery Data Source, and BOOEM!!!

This was just too easy. I’ll submit a video tutorial on how to achieve this as soon as I’m done with my other tutorials. My backlog is starting to build up. However, for those who are anxious, use the video link I added in this post, and reference the notes below:

NOTES FOR DB2 INTEGRATION:

Using Niklas’s Video as a reference, do the following:

1. in your .jdbc file that you need to create in the Database’s Package Explorer under the “WEB-INF/jdbc” folder, have your XML look something along the lines of:

2. You will need to copy the 2 JDBC Jar Files that come with the DB2 Install into the “jvmlibext” folder in the Domino Program Directory.

3. Restart the HTTP Server (Restart Task HTTP)

You should be able to come right by following the rest of the video.

Enjoy, and please feel free to provide feedback.

John Jardin