0

has anyone work wit monetDb and .Net. I am having a hard time to find the right Connection String for the MonetDB using .Net. So far I know this from documentation and some other forums.

My monetserver is running on one machine and the .Net client I am running on another machine.

I will have to install both 32bit and 64bit ODBC driver on client machine.

I have to add "Microsoft.Practices.EnterpriseLibrary.Data" reference in my solution.

I have to set build configuration "Platform Target" to value "x64" as my OS is 64bit.

using System;
using System.Data.Common;
using System.Data.Odbc;
using System.Windows.Forms;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace WindowsFormsApplication1221
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            try
            {
                {
                    OdbcConnection cn;
                    OdbcCommand cmd;
                    string MyString;
                MyString = "Select * from test1";

                cn = new OdbcConnection("dsn=MonetDB;UID=monetdb;PWD=monetdb;");

                cmd = new OdbcCommand(MyString, cn);

                cn.Open();
                MessageBox.Show("Connected");

                cn.Close();
            }
        }
        catch (Exception e)
        {
            int i = 1;
        }


        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
}

}

I have installed the latest monetDB on my windows 7 64 os. i have also imprted the sample voyages table that they provided to start learning the monetDB.

I haven't change any server/client configuration and using default setup only.

Anup Shah
  • 1,256
  • 10
  • 15

2 Answers2

2

You forget to point remote server and its port:

 var monetDbC = new OdbcConnection("Driver={MonetDB ODBC Driver};HOST=YourRemoteServerName;PORT=50000; Database=YourDBName;UID=monetdb; PWD=monetdb");
hjortron
  • 329
  • 1
  • 13
0

After intalling to MonetDB ODBC diriver , try my client library for a MonetDB client - http://www.nuget.org/packages/MonetDBClient/

Elyor
  • 900
  • 1
  • 12
  • 26