Forgot password?
  • Home
  • /
  • White Papers
  • /
  • How to add a connector to an Oracle database in the report designer using the plug-in

How to add a connector to an Oracle database in the report designer using the plug-in

Dmitriy Fedyashov

Perhaps you have never used plug-ins for the report designer FastReport.Net. Then this article is for you. As you know, in order to display data from the database in the report, you need to create a connection to the data source. You can do this in the code of the user application or within the report itself. In the first case, you have to create a connection, send it to the report and register it in the report. Not the fastest way actually. However, it is much faster to connect to the data inside the report. Although, if you create many reports with the connection to the same data source, the first method is still preferable. But in this article we will talk about the second way.

1. The essence of plug-ins with connectors to databases is to simplify the procedure for connecting to the database from the report. You can install a native connector, but connecting with it will take more time due to the abundance of settings.

In the delivery of FastReport.Net there is a set of plug-ins with connectors to various databases. But we are interested in this particular: C: \ Program Files (x86) \ FastReports \ FastReport.Net \ Extras \ Connections \ FastReport.Oracle. We open the solution. By default, the project is configured to .Net Framework 2.0. You need to switch it to something fresh, for example 4.5. Otherwise, there will be problems with the FastReport library.

Check the project references. You need to update the link to the FastReport.dll library that you will find in this folder: C: \ Program Files (x86) \ FastReports \ FastReport.Net.

That is it. We build the solution and get the FastReport.Oracle.dll library in the Release folder.

2. Open the report designer. To add a new plug-in, select the File -> Options menu.

 

Use the Add button to add the library we collected earlier. For the changes to take effect, you must restart the designer.

 

There are two other ways to add a plug-in to the designer.

1. You can edit the config file of the designer FastReport.config, which is stored along this path:

C: \ Documents and Settings \ user_name \ Local Settings \ Application Data \ FastReport.

The configuration file is an XML document. We are interested in the <Plugins> section in which you need to add a new plugin:

1
2
3
<Plugins>
 <Plugin Name = "c: \ ..... \ FastReport.Oracle.dll" />
 </ Plugins>

 2. From the code of the user application, you need to register a new connection once:

FastReport.Utils.RegisteredObjects.AddConnection (typeof (OracleDataConnection));

 Preliminarily, of course, you need to add a link to FastReport.Oracle.dll in the project.

 

Now you can add a new data source to the report.

 

Click on New connection:

 

Choose the type of connection Oracle connection. Fill in the fields: server name, username and password.

 

Click Ok. Then, select the tables you need for the report. As a result, we get the data source in the window on the upper right:

 

That's all. We got the data from the Oracle database, using the plug-in connector. Now the new connection will always be available in the connection type selection list. At least until you remove the plugin in the designer's settings, of course.

 

Similar articles:

back