01 August 2012

Using a connection profile store with BIRT

After a bit of trial-and-error I managed to get connection profiles to work with BIRT. It is important to keep to the following sequence.

  • Open the Data Source Explorer view
  • Create all the connection profiles you need. e.g. test, staging and production for each connection type. Give them names which indicate the environment they are in (MS_SQL_Test, MS_SQL_Prod etc.)
  • Export the required connection profiles to a file in the report project e.g. connectionStore.xml
  • In the report project, create a new DataSource and select the second radio button 'Create from a connection profile in the profile store'
  • Select the profile store file and choose a connection profile. Perhaps deselect the 'Use default data source name' and enter a environment-independant name (e.g. MS_SQL instead of MS_SQL_Test). Choose Ok to end
  • Open the Data Source and select 'Property Binding'
  • Edit 'Connection Profile Name' -- params["__runtime"].value.toLowerCase() == 'prod' ? 'MS SQL Prod' : 'MS SQL Test' -- or something similar. The returned value must correspond to the name of a connection profile in the store.
  • Define a parameter named '__runtime' and use the Combo Box option to set the valid values: 'test', 'prod' etc
  • That's it
You should now be able to select the connection environment using the report parameter.
Update
When I deployed this to the server (websphere) the profile switching between prod & test did not work. This was because the profile store was not being found. Unfortunately, there is no error message - it just takes the default connection settings. The connection store needs to be placed in the server's context root.

16 March 2012

Success with pvc.webcontainer

Finally got my little app working with com.ibm.pvc.webcontainer. I installed the Domino upgrade 8.5.3 and my plugin works! Seems there were problems with 8.5.2.

One important point is to refresh the target definition in eclipse: Window->Prefs->Plug-in Dev->Target. Reload. Otherwise there will be unresolved plugins in the projects.


12 September 2011

OpenJPA as an OSGi bundle

http://hwellmann.blogspot.com/2010/09/openjpa-and-osgi.html

06 September 2011

15 June 2011

Mixing Linq-to-SQL and Linq-to-XMl

I have been trying to select a column containing XML text from a database and then selecting nodes from the XML using Linq. It didn't work. My guess is that deferred execution causes the queries to be mixed and taken as Linq-to-SQL. As a result the XML stuff causes problems.

My solution was to force an intermediate result so that there is a break between SQL and XML queries. My code for LinqPad is as follows.

var all = from bm in mytable
          select new { name=bm.SPP_USER_ID, xml=(string)bm.SPP_BOOKMARKS_XML};

var docs = from x in all
           select XDocument.Parse(x.xml);
var docs2 = docs.ToList(); // FORCE RESULT

XNamespace ns = "http://acme/bookmarks";
var href = from h in docs2.Descendants(ns + "href")
           select h.Value;  

15 April 2011

Strange and annoying problem with {NOBR}

I wrote a web app about 10 years ago which used Javascript to pop up a hidden table when an input field gets focus. Each cell in the table contains a checkbox and text which are surrounded by a NOBR to keep them together.

Recently users with IE8 complained that the first cell is not visible when the table pops up. After MUCH trial and error I narrowed it down to the NOBR tag. I replaced it with a SPAN with style set to white-space : nowrap and this seems to solve the problem :-/

05 April 2011

Using 3rd party libraries in Silverlight

I downloaded a 3rd party library for a Silverlight app I am writing. When I ran the app I got an error message telling me to add

<loadFromRemoteSources enabled="true"/>

to 'devenv.exe.config' (Usually in 'C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE').

It seems you also need to edit the 'Blocked' property of the DLL.

See How to: Use an Assembly from the Web in Visual Studio for full details.