Synopsis: Fed up creating new data sources each time you create a new BIRT report, or simply too lazy to remember the connection strings every time? This guide shows you how to set up any number of pre-defined connection strings that you can call upon at any time in BIRT Designer.<br />
<br />
BIRT CONNECTION PROFILES<br />
<br />
OK hands up if you have a rubbish memory like me! OK there are a number of things I can remember, like my wifes birthday, our wedding anniversary and other such things that are essential to survival but there are certain things that I simply can’t (or maybe don’t want to) keep in my head.<br />
<br />
One example of this is the JDBC connection string for SQL Server databases that I use within my BIRT data sources. You know the thing that looks like this:<br />
<br />
jdbc:jtds:sqlserver://server[:port][/database];<br />
<br />
I can remember the server name (usually) and for some strange reason (although I hate to admit it) I can remember that SQL Server lives on port 1433 and I can also sometimes remember the name of the database that I want to connect to. What I seem dismally unable to remember is the structure of the connection string itself.<br />
<br />
Ultimately this means that every time I create a new BIRT report I have to create a new data source and lookup the connection string from one of my own texts on the subject. This makes me feel rather silly and so I eventually resorted to keeping a text file on the desktop of my BIRT machine, containing just the connection string! This way I can easily access the connection string and copy it into my report.<br />
<br />
Well, I have found a better way! It’s called Connection Profiles and it allows you to store away connections to all your databases, including the login credentials, in a central location that can be accessed directly from within the BIRT designer whenever you need them.<br />
<br />
SETTING UP A CONNECTION PROFILE<br />
<br />
In the BIRT designer, open the Window menu, select Show View and Other. Then from the dialogue that appears, expand the Data Management section and highlight the Data Source Explorer item, then press OK.<br />
<br />
You will see that the Data Source Explorer tab and it’s contents appears in the lower pane of the designer window.<br />
<br />
To create a data source, select the appropriate data source type, in this example I am going to create a SQL Server source, so I highlight JDBC Data Source, right click and select New...<br />
<br />
I name the data source and give it a description, then click next. Now we are in familiar territory, looking at the standard data source creation screen. If you are not familiar with this please refer to my guide “The complete getting started guide to BIRT Reporting” where you will find a full description of how to create a data source.<br />
<br />
The test connection button tells me that I have entered the correct information. On clicking finish I see that my SQL Server connection is saved to the Data Source Explorer.<br />
<br />
USING THE DATA SOURCE <br />
<br />
Now when I want to create a data source it is simplicity itself, with no remembering to do!<br />
All I have to do is right click on the Data Sources item in the Data Explorer pane and select New Data Source<br />
<br />
And in the next screen select the radio button called “Create from a connection profile in the profile store” and click next.<br />
<br />
Now I just browse to my profile store, which by default is saved in a sub folder of the BIRT workspace. When I installed BIRT I made my workspace C:BIRT, so the full path to my profile is:<br />
<br />
C:BIRT.metadata.pluginsorg.eclipse.datatoolsconnectivty<br />
<br />
Once I have browsed to here I select the ServerProfiles.dat file<br />
<br />
BIRT opens up the data profiles store and shows me all the profiles I have previously created.<br />
<br />
So now all I have to do is select the one I want to use, in my example “My local SQL server” and on clicking next I see the data source screen pre-filled with my data connection details!<br />
<br />
Click finish and that’s it, a few easy steps to adding my saved data source to my new BIRT report.<br />
<br />
CONCLUSION<br />
<br />
If you have a number of different databases that you report on regularly then creating connection profiles makes the task of setting up data sources that much easier. Give it a try and let me know how you get on and what you think of this tip. <br />
<br />
MORE INFORMATION<br />
<br />
If you would like to download the full version of this report with screen shots in PDF format or find out more about BIRT reporting and the BIRT User Group UK then please visit <br />
<br />
<a class='bbc_url' href='
http://www.BIRTReporting.com'>BIRT Reporting Articles, News and Support</a><br />
<br />
Please feel free to share this address with your colleagues and inspire them to use BIRT to create great looking reports.<br />
<br />
I look forward to your feedback so please feel free to send me an email and let me know how you get on with BIRT, provide feedback on this guide, share your tips and tricks, or request help for specific problems. I can’t guarantee to personally solve everyone’s problems but there are some great BIRT related forums out there and you can find a growing list of links and resources on my site. <br />
<br />
Paul Bappoo<br />
<br />
<a href='mailto:' title='E-mail Link' class='bbc_email'>Paul@BirtReporting.com</a><br />
<a class='bbc_url' href='
http://www.BIRTReporting.com'>BIRT Reporting Articles, News and Support</a>