Integration/Tutorials/connect-to-the-database.md
... ...
@@ -10,9 +10,10 @@ Izenda Reports lets business users generate simple custom reports without involv
10 10
11 11
**Izenda Reports supports the following databases:**
12 12
13
-* SQL Server 2000-2012
14
-* Oracle 9g
15
-* MySQL 5
13
+* SQL Server 2000/2005/2008/2012/2014/2016
14
+* Oracle 9i/10g/11g/12c
15
+* MySQL 5+
16
+* PostgreSQL 9+
16 17
* OData (requires FUSION add-on)
17 18
* Web Services and EAV (with custom implementation)
18 19
... ...
@@ -22,7 +23,7 @@ Izenda Reports lets business users generate simple custom reports without involv
22 23
23 24
Izenda Reports supports connecting to multiple data sources simultaneously by using views. Views are the simplest and most secure way to connect to many different data sources in order to build reports. For specific examples of how to apply and use views, [[click here|http://wiki.izenda.us/Integration/Tutorials/Views]].
24 25
25
-##Microsoft SQL Server 2000/2005 Setup
26
+##Microsoft SQL Server 2000/2005/2008/2012/2014/2016 Setup
26 27
27 28
**Requirements:**
28 29
... ...
@@ -46,7 +47,7 @@ Izenda Reports supports connecting to multiple data sources simultaneously by us
46 47
* Start up your project or navigate to your web server via browser
47 48
* Izenda Reports is ready for use
48 49
49
-##Oracle 9i/10g Setup
50
+##Oracle 9i/10g/11g/12c Setup
50 51
51 52
**Requirements (must be installed prior to database setup):**
52 53
... ...
@@ -75,7 +76,7 @@ User Id=myUsername;Password=myPassword;"**
75 76
* Start up your project or navigate to your web server via browser
76 77
* Izenda Reports is ready for use
77 78
78
-##MySQL Setup
79
+##MySQL 5+ Setup
79 80
80 81
**Requirements (must be installed prior to database setup):**
81 82
... ...
@@ -95,13 +96,92 @@ User Id=myUsername;Password=myPassword;"**
95 96
* Open your Izenda Reports Global.asax file in your IDE and find the ``InitializeReporting()`` method.
96 97
* Update the [[LicenseKey|http://wiki.izenda.us/API/CodeSamples/LicenseKey]] and [[ConnectionString|http://wiki.izenda.us/API/CodeSamples/MySqlConnectionString]]
97 98
* Sample standard connection string (using SSL):
98
- * **"Driver={MySQL ODBC 5.2 ANSI Driver};Server=myServerAddress;Database=myDataBase;User=myUsername;Password=myPassword;sslca=c:\cacert.pem;sslcert=c:\client-cert.pem;sslkey=c:\client-key.pem;sslverify=1;Option=3;"**
99
+ * **"Driver={MySQL ODBC 5.3 ANSI Driver};Server=myServerAddress;Database=myDataBase;User=myUsername;Password=myPassword;sslca=c:\cacert.pem;sslcert=c:\client-cert.pem;sslkey=c:\client-key.pem;sslverify=1;Option=3;"**
99 100
* Other sample connection strings: https://www.connectionstrings.com/mysql/
100 101
* Save your global.asax
101 102
* Build your project
102 103
* Start up your project or navigate to your web server via browser
103 104
* Izenda Reports is ready for use
104 105
106
+##PostgreSQL 9+
107
+
108
+**About**
109
+
110
+The PostgreSQLConnectionString is what Izenda AdHoc uses to initialize an PostgreSQL connection. This will do all the heavy lifting for including tables, functions, and stored procedures. It will also build queries utilizing the Izenda PostgreSQL Driver.
111
+
112
+Below is a sample global.asax using the PostgreSQLConnectionString setting. The code block will appear within ``<script runat="server"> </script>`` tags within global.asax.
113
+
114
+**Global.asax (C♯)**
115
+```c#
116
+
117
+//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
118
+public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
119
+{
120
+ // Configure settings
121
+ // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
122
+ public static void InitializeReporting() {
123
+ //Check to see if we've already initialized.
124
+ if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
125
+ return;
126
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
127
+ //Creates a connection to Microsoft SQL Server
128
+ AdHocSettings.PostgreSQLConnectionString = "INSERT_CONNECTION_STRING_HERE"; //The relevant setting
129
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
130
+ HttpContext.Current.Session["ReportingInitialized"] = true;
131
+ }
132
+}
133
+```
134
+
135
+**Global.asax (VB.NET)**
136
+
137
+```visualbasic
138
+
139
+'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
140
+Public Class CustomAdHocConfig
141
+ Inherits Izenda.AdHoc.DatabaseAdHocConfig
142
+
143
+ Shared Sub InitializeReporting()
144
+ 'Check to see if we've already initialized
145
+ If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then
146
+ Return
147
+ 'Initialize System
148
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
149
+ AdHocSettings.PostgreSQLConnectionString = "INSERT_CONNECTION_STRING_HERE" 'The relevant setting
150
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
151
+ HttpContext.Current.Session("ReortingInitialized") = True
152
+ End Sub
153
+
154
+End Class
155
+```
156
+
157
+**Parts of a Connection String**
158
+
159
+Izenda uses a third party .NET data provider to connect to PostgreSQL instances, called Npgsql. There are certain patterns that are recognized as settings within the connection string for Npgsql, such as the User ID and Password, and the structure of the connection string differs from other ODBC, JDBC, and OLE DB providers for PostgreSQL databases. You can read more about the parts of the Npgsql PostgreSQL connection string [[here|https://github.com/npgsql/npgsql/wiki/User-Manual#connection-string-parametersx]]. Here are the essential parts of the connection string:
160
+
161
+* **Server** - Address/Name of PostgreSQL Server.
162
+* **Port** - Port to connect to. Default is 5432.
163
+* **Database** - The name of the database you want to connect to. Defaults to user name if not specified.
164
+* **User ID** - The username that you're logging in as (Not recommended, but still popular). It is recommended to use Integrated Security instead.
165
+* **Password** - The password you're using to log into the database (Not recommended, but still popular). It is recommended to use Integrated Security instead.
166
+* **Integrated Security** - When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication.
167
+Recognized values are true or false. Default is set to false.
168
+
169
+There are many different constructions of a proper connection string. Please see the link above for more information.
170
+
171
+Then you simply have to insert the values you need into the connection string:
172
+
173
+```csharp
174
+public static void InitializeReporting()
175
+{
176
+ String uname = HttpContext.Current.Session["UserName"];
177
+ String pw = HttpContext.Current.Session["Password"]; //unsecure. Use at your own risk. There are many great articles about how to handle usernames and passwords and perhaps your organization already uses one.
178
+
179
+ Izenda.AdHoc.AdHocSettings.PostgreSQLConnectionString =
180
+ "Server=zag.izenda.com;Port=5432;Database=Northwind;User ID="+ uname +
181
+ ";Password=" + pw + ";Integrated Security=False";
182
+}
183
+```
184
+
105 185
##Testing your connection string
106 186
107 187
If you wish to test your connection string to ensure connectivity, you can perform the following steps: