<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Setup_for_SQL_Server</title><link>https://sourceforge.net/p/ibd/wiki/Setup_for_SQL_Server/</link><description>Recent changes to Setup_for_SQL_Server</description><atom:link href="https://sourceforge.net/p/ibd/wiki/Setup_for_SQL_Server/feed" rel="self"/><language>en</language><lastBuildDate>Tue, 20 May 2014 18:43:58 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/ibd/wiki/Setup_for_SQL_Server/feed" rel="self" type="application/rss+xml"/><item><title>Setup_for_SQL_Server modified by Alessandro Vernet</title><link>https://sourceforge.net/p/ibd/wiki/Setup_for_SQL_Server/</link><description>&lt;div class="markdown_content"&gt;&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#rational"&gt;Rational&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#installation"&gt;Installation&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#database-setup"&gt;Database Setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#application-server-setup"&gt;Application Server Setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#creating-the-contract-table"&gt;Creating the Contract Table&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#verify-data-is-stored"&gt;Verify Data is Stored&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h1 id="rational"&gt;Rational&lt;/h1&gt;
&lt;p&gt;IBD can store part of the information captured in the form in a relational database. Out of the box, IBD: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stores the contract information (under /instance/Contract in the main instance). &lt;/li&gt;
&lt;li&gt;Works with SQL Server. (The instructions below are for SQL Server, but this should work with other relational databases for which you have a JDBC driver). &lt;/li&gt;
&lt;li&gt;Stores each "contract" as a row of the &lt;em&gt;contract&lt;/em&gt; table. &lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id="installation"&gt;Installation&lt;/h1&gt;
&lt;h2 id="database-setup"&gt;Database Setup&lt;/h2&gt;
&lt;p&gt;Install SQL Server and create a database with a name of your choice. What follows assumes that the database name is &lt;em&gt;ibd&lt;/em&gt;. You don't need to explicitly create a table in the database; this will be done later by the application (see below). &lt;/p&gt;
&lt;h2 id="application-server-setup"&gt;Application Server Setup&lt;/h2&gt;
&lt;p&gt;First, setup a data source in your application server (or servlet container). With Tomcat, edit the &lt;code&gt;conf/server.xml&lt;/code&gt; and add the following resource inside the &lt;code&gt;&amp;amp;lt;Context&amp;amp;gt;&lt;/code&gt; element you setup for the IBD application: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="n"&gt;Resource&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;jdbc/ibd&amp;quot;&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Container&amp;quot;&lt;/span&gt; &lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;javax.sql.DataSource&amp;quot;&lt;/span&gt;
      &lt;span class="n"&gt;initialSize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;3&amp;quot;&lt;/span&gt; &lt;span class="n"&gt;maxActive&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;10&amp;quot;&lt;/span&gt; &lt;span class="n"&gt;maxIdle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;20&amp;quot;&lt;/span&gt; &lt;span class="n"&gt;maxWait&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;30000&amp;quot;&lt;/span&gt;
      &lt;span class="n"&gt;driverClassName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;com.microsoft.jdbc.sqlserver.SQLServerDriver&amp;quot;&lt;/span&gt;
      &lt;span class="n"&gt;poolPreparedStatements&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;true&amp;quot;&lt;/span&gt;
      &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;sa&amp;quot;&lt;/span&gt;
      &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&amp;quot;&lt;/span&gt;
      &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;jdbc:microsoft:sqlserver://192.168.0.201:1433;DatabaseName=ibd;SelectMethod=Cursor&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;/&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Make sure to change the user name, password, IP address (or host name), and database name as appropriate. The name of the resource (&lt;em&gt;jdbc/ibd&lt;/em&gt;) must be left unchanged, as the data source is referenced using this name in the code. &lt;/p&gt;
&lt;p&gt;Second, install the SQL Server JDBC driver. Download the &lt;a class="" href="http://www.microsoft.com/downloads/details.aspx?familyid=9f1874b6-f8e1-4bd6-947c-0fc5bf05bf71&amp;amp;displaylang=en" rel="nofollow"&gt;SQL Server JDBC driver&lt;/a&gt;, which is a file named &lt;code&gt;mssqlserver.jar&lt;/code&gt;. Place this file in the appropriate directory so the driver is available to your application server. For Tomcat, copy &lt;code&gt;mssqlserver.jar&lt;/code&gt; to &lt;code&gt;common/lib&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;After doing those changes, you need to restart Tomcat. &lt;/p&gt;
&lt;h2 id="creating-the-contract-table"&gt;Creating the Contract Table&lt;/h2&gt;
&lt;p&gt;To create the &lt;code&gt;contract&lt;/code&gt; table, make sure Tomcat is started, and go to the following URL: &lt;a href="http://localhost:8080/orbeon/fr/service/custom/iadb/create-table?form=standard-rfp" rel="nofollow"&gt;http://localhost:8080/orbeon/fr/service/custom/iadb/create-table?form=standard-rfp&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This will return a web page with the DDL you need to run to create the &lt;code&gt;standard_rfp&lt;/code&gt; table in the &lt;code&gt;ibd&lt;/code&gt; database. You are responsible for running this DDL as appropriate against the &lt;code&gt;idb&lt;/code&gt; database. Replace on the URI &lt;code&gt;standard-rfp&lt;/code&gt; by the name of another form to get the DDL of the table corresponding to that form (e.g. &lt;code&gt;form=goods&lt;/code&gt;). Note that if the form name contains dashes, they will be replaced by underscores in the table name. &lt;/p&gt;
&lt;h2 id="verify-data-is-stored"&gt;Verify Data is Stored&lt;/h2&gt;
&lt;p&gt;To check that saving to SQL Server works as expected: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start with a &lt;a class="" href="http://localhost:8080/orbeon/fr/iadb/standard-rfp/new/" rel="nofollow"&gt;new form&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;Under &lt;em&gt;Requested Consulting Services&lt;/em&gt; select &lt;em&gt;Conustant's Services Time-Based Contract&lt;/em&gt;. &lt;/li&gt;
&lt;li&gt;Under &lt;em&gt;Contract&lt;/em&gt;, &lt;em&gt;Applicable law and language&lt;/em&gt;, choose &lt;em&gt;No&lt;/em&gt; for &lt;em&gt;Applicable law is the same as the Client's Country&lt;/em&gt;, then enter some text in the field &lt;em&gt;Law that will govern the contract&lt;/em&gt;. Then hit the &lt;em&gt;Save to database&lt;/em&gt; button: &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;[Image:Save-to-datebase.png]&lt;/span&gt; &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This field you modified is bound to &lt;code&gt;Contract/GovernmentLaw/Country&lt;/code&gt; in the instance. This element will be automatically mapped to the column &lt;code&gt;GovernmentLaw_Country&lt;/code&gt;. Check that the table contains the text you entered in the previous step by running &lt;code&gt;select GovernmentLaw_Country from contract&lt;/code&gt;. You should now see the value you entered: &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;[Image:Country-column.png]&lt;/span&gt; &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alessandro Vernet</dc:creator><pubDate>Tue, 20 May 2014 18:43:58 -0000</pubDate><guid>https://sourceforge.net1db48e057eb0fc87fa2ed163add13983121fee35</guid></item></channel></rss>