Om verbinding te maken met een Invantive applicatie of een applicatie gebaseerd op Invantive Producer moet er een bestand settings.xml zijn met hierin de configuratie van de verbindingsinstellingen. Dit moet een XML-bestand zijn met dezelfde opzet als het voorbeeld verderop. Het bestand kan de configuratie bevatten om verbinding te kunnen maken met één of meerdere servers.
Als je een Invantive-gebaseerde applicatie product voor het eerst start wordt het settings.xml bestand achtereenvolgens gezocht op meerdere locaties:
•de installatiemap met daarin setup.exe;
•vanuit de installatiemap een map omhoog;
•vanuit de installatiemap een map omhoog en dan in de pfile map er onder;
•vanuit de installatiemap twee mappen omhoog;
•vanuit de installatiemap twee mappen omhoog en dan in de pfile map er onder;
•vanuit de installatiemap drie mappen omhoog;
•vanuit de installatiemap drie mappen omhoog en dan in de pfile map er onder;
•in de map c:\ws.
Als het settings.xml bestand niet is gevonden, dan krijgt de gebruiker een vraag waar het settings.xml bestand te vinden is. De gekozen locatie van het settings.xml bestand wordt onthouden en voortaan gebruikt.
In onderstaande tekst staat beschreven hoe het werkt:
<?xml version="1.0" encoding="utf-8"?>
<!--
(C) 2004-2013 Invantive BV, the Netherlands (www.invantive.com).
$Header: http://svn.invantive.com/repos/p104/trunk/help/nl/manual/Topics/verbindingsconfiguratie.xml 23549 2013-11-01 14:21:27Z smoke $
Purpose:
Configuration of the Invantive Webservice and direct database connections
available to client and the Invantive Webservice acting as a database client.
Explanation:
Connections are used to retrieve data from a database and to update the contents of databases.
This settings file can accommodate all settings for database and web service connections
that are used by Invantive products.
This file contains a number of structured elements, explained further on.
Top level: the connection groups.
This is the root level of the settings file. It only contains connections groups.
Attributes:
* "default": The default connection. The format is 'group\connection'.
the first connection with the given name will be used when the group element is omitted.
* "forceDefault": If true, only the default connection can be used. No other connection is
eligible for selection based upon this settings.xml file. You can use for instance when you
add a new default connection and you want to make sure everyone switches to the new connection,
irrespective of what connection is currently used as default.
The group level:
This level defines a set of connections, logically grouped together. You are
free to choose the way of grouping.
Examples of logical manner of grouping: by customer, by environment (production, test).
Attributes:
* "name": The name of the group.
The connection level:
This level defines an actual logical connection.
For example: Production environment Acme site.
Under this level, the actual transport mechanism and its settings can be defined.
The connection and associated failovers are tried when initially establishing the connection and when reconnecting
after the provider detected a connection loss.
The elements of this level can consist of two types:
* physical connection (either an Invantive Webservice or direct database connection);
* failovers.
All physical connections listed will be brought online during application use.
Attributes:
* "name": The name of the logical connection.
The webservice element:
This element defines a connection using the Invantive.Providers.Webservice provider.
This provider is capable of proxying database connections over HTTP/HTTPS. A client
can connect to a database directly through a webservice, but a webservice can route
this request also to another Invantive Webservice and so on.
Attributes:
* "url": the url of the Invantive Webservice.
* "encoding": the encoding to use.
This will be passed as header on the request.
Allowed values are: "binary" or "text". Default: binary. Use text for debugging purposes or with poor CPU.
* "compression": the compression method to use.
This will be passed as header on the request. Allowed values are: "auto", "true" or "false". Default: "auto" (will set compression enabled)
Within a fast LAN network and/or with slow servers, we recommend no compression. In all other situations, we recommend
compression to be enabled.
The database element:
This element defines a connection to a database using a provider
specific for that type of database.
Attributes:
* "connectionString": the ADO.NET connection string for the specified provider.
You can specify Data Source, User Id and other settings.
* "provider": the name of the ADO.NET connection provider.
For example: "Oracle.DataAccess.Client"
The failover level:
The failover level can define a list of database or webservice settings.
It supplements the webservice/database element.
Connection settings defined in a failover can be used to
have a failover connection when one connection cannot be established.
This can be useful when relying on a internet connection or presence of a VPN tunnel.
Settings defined in this section will be evaluated one after another, starting top down.
When any of the failovers can be established, no other failovers will be tried.
Attributes:
* (none)
Examples:
This example illustrates a single connection. The software will sequentially try to:
* Connect to the 'authenticationServer' Active Directory server;
* Connect to one of the connections in the failover:
- First the database connection (when connection from the internal network or VPN);
- The first webservice connection;
- The second (or 'failover') webservice connection.
<connections default="Customer A\Production" forceDefault="false">
<group name="Customer A">
<connection name="Production">
<database connectionString="Data Source=authenticationServer;User Id=username;Password=thepublicpassword;Pooling=false" provider="Invantive.CustomerA.ActiveDirectory" />
<failover>
<database connectionString="Data Source=localhost;User Id=username;Password=thepublicpassword;Pooling=false" provider="Oracle.DataAccess.Client" />
<webservice url="http://www.customer-a.com/ws/" encoding="binary" compression="true" />
<webservice url="http://failover.customer-a.com/ws/" encoding="binary" compression="true" />
</failover>
</connection>
</group>
</connections>
This example illustrates connections to different database platforms. The software will try to:
* Connect to the IBM DB2 UDB database when connection 'DB2' is selected;
* Connect to the Microsoft SQL Server database when connection 'SQLServer' is selected;
* Connect to the Oracle MySQL server when connection 'MySQL' is selected;
* Connect to the Oracle RDBMS server when connection 'Oracle' is selected;
<connections default="Customer A\Production" forceDefault="false">
<group name="Customer A">
<connection name="DB2">
<database connectionString="Server=localhost;Database=THE_DATABASE;UID=username;PWD=password;CurrentSchema=schema" provider="IBM.Data.DB2" />
</connection>
<connection name="SQLServer">
<database connectionString="Server=localhost;Database=database;User Id=username;Password=password;" provider="System.Data.SqlClient" />
</connection>
<connection name="MySQL">
<database connectionString="Server=localhost;Database=database;Uid=username;Pwd=password" provider="MySql.Data.MySqlClient" />
</connection>
<connection name="Oracle">
<database connectionString="Data Source=localhost;User Id=username;Password=password" provider="Oracle.DataAccess.Client" />
</connection>
</group>
</connections>
-->
<connections default="Customer A\Production" forceDefault="false">
<group name="Customer A">
<connection name="Production">
<database connectionString="Data Source=authenticationServer;User Id=username;Password=thepublicpassword;Pooling=false" provider="Invantive.CustomerA.ActiveDirectory" />
<failover>
<database connectionString="Data Source=localhost;User Id=username;Password=thepublicpassword;Pooling=false" provider="Oracle.DataAccess.Client" />
<webservice url="http://www.customer-a.com/ws/" encoding="binary" compression="true" />
<webservice url="http://failover.customer-a.com/ws/" encoding="binary" compression="true" />
</failover>
</connection>
</group>
</connections>