2 // OdbcDataReaderTest.cs
5 // Satya Sudha K (ksathyasudha@novell.com)
8 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.Data.Odbc;
34 namespace MonoTests.System.Data {
36 public class MySqlOdbcRetrieve : MySqlRetrieve {
38 public MySqlOdbcRetrieve (string database) : base (database)
42 // returns a Open connection
43 public override void GetConnection ()
45 string connectionString = null;
47 connectionString = ConfigClass.GetElement (configDoc, "database", "OdbcConnString");
48 } catch (Exception e) {
49 Console.WriteLine ("Error reading the config file");
50 Console.WriteLine (e.Message);
54 con = new OdbcConnection (connectionString);
57 } catch (Exception e) {
58 Console.WriteLine ("Cannot establish connection with the database");
64 public class MsSqlOdbcRetrieve : MsSqlRetrieve {
66 public MsSqlOdbcRetrieve (string database) : base (database)
70 // returns a Open connection
71 public override void GetConnection ()
73 string connectionString = null;
75 connectionString = ConfigClass.GetElement (configDoc, "database", "OdbcConnString");
76 } catch (Exception e) {
77 Console.WriteLine ("Error reading the config file");
78 Console.WriteLine (e.Message);
82 con = new OdbcConnection (connectionString);
85 } catch (Exception e) {
86 Console.WriteLine ("Cannot establish connection with the database");
92 public class OracleOdbcRetrieve : OraRetrieve {
94 public OracleOdbcRetrieve (string database) : base (database)
98 // returns a Open connection
99 public override void GetConnection ()
101 string connectionString = null;
103 connectionString = ConfigClass.GetElement (configDoc, "database", "OdbcConnString");
104 } catch (Exception e) {
105 Console.WriteLine ("Error reading the config file");
106 Console.WriteLine (e.Message);
110 con = new OdbcConnection (connectionString);
114 } catch (Exception e) {
115 Console.WriteLine ("Cannot establish connection with the database");
121 public class PostgreOdbcRetrieve : MySqlRetrieve {
123 public PostgreOdbcRetrieve (string database) : base (database)
127 // returns a Open connection
128 public override void GetConnection ()
131 string connectionString = null;
133 connectionString = ConfigClass.GetElement (configDoc, "database", "OdbcConnString");
134 } catch (Exception e) {
135 Console.WriteLine ("Error reading the config file");
136 Console.WriteLine (e.Message);
140 con = new OdbcConnection (connectionString);
143 } catch (Exception e) {
144 Console.WriteLine ("Cannot establish connection with the database");