Question

What is the process to access data from a SQL data source and have it fill in a list box control so that the user may select one of the values?

I have been given the name of the database and server, the login ID and password.

Code samples would really be appreciated as I have never done any SQL coding.

Was it helpful?

Solution

I've created a video showing JDBC access from XPages: http://www.youtube.com/watch?v=p6oRCsTsVqc

OTHER TIPS

The latest Extension Library on OpenNTF ( extlib.openntf.org ) has a whole bunch of Relational Database extensions.

You'll need to get the JDBC drivers for whatever SQL server your going to be accessing and then take a look at the ExtLib demo application on how to create the JDBC connector from your application. Once the connector is in place you can then just the new controls in ExtLib to easily create a view pane etc.

You will also need more then the SQL server, username and password, you'll need to find out the different tables that you'll be accessing so that you can reference them from your Xpages application.

Wait for the book that will e released soon about the extlib. I know Jeremy hodge wrote the chapter so you might be able to get some info from him.

From an answer I gave earlier: you might want to check out the blog post announcing the JDBC support . It has an excellent video explanation and a link to a slide deck.

Also, take a look at Xpages101 lesson 61. It's paid-for content, but well worth it if you're serious about Xpages development.

If you want to combine Upgrade Pack 1 (UP1) with the Extension Library JDBC parts, then make sure to use the Extension Library that matches exactly the UP1 version. This is version 853-20111215 of the Extension Library. Then you can use the update site method to only deploy the experimental parts of the Extension Library (com.ibm.xsp.extlibx.feature_8.5.3.20111215-0914.jar).

For newer releases of Extension Library things might (will) have changed so that UP1 and Extension Library can not work together.

When UP2 is released, you need to remove the Extension Library package and deploy UP2. At that point in time UP2 might contain the JDBC support.

Roy, As the previous posters put the ext library stuff will make it a little more "Drag and Drop", but you can use regular JDBC connection to get the data you want, Its pretty simple, but a lot more code than using Domino as a backend. You might want to look at this John Mackey blog post about doing a very similar thing...http://www.jmackey.net/groupwareinc/johnblog/johnblog.nsf/d6plinks/GROC-7G9GT4

Keep in mind that you need the actual ext. library for this. The upgrade pack does not contain the JDBC stuff.

Edit: Keep in mind that if you don't need "LIVE" data access, and the information you want is fairly static you could always just use a lotusscript agent to pull the data down into Notes Documents. Run that once a day or whatever. No fancy XPages stuff needed. That's fairly common coding and practices with examples available.

Then just have the list box pull from the documents you brought down.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top