This is my first firebird / Mono project with .net so I'm a complete newbie.

I have a database stored int /var/db/menumate.fdb

I can connect to it fine using flamerobin.

I cant connect to it with the following code.

logger.Debug("Connecting to DB.");
            FbConnectionStringBuilder cs = new FbConnectionStringBuilder();
            cs.DataSource = "localhost";
            cs.Database = "/var/db/menumate.fdb";
            cs.UserID = "SYSDBA";
            cs.Password = "masterkey";
            cs.Dialect = 3;
            cs.Port = 3050;
            // I have tried these charsets just in case the make no
difference.
            //cs.Charset = "NONE";
            //cs.Charset = "UNICODE_FSS";
            //cs.Charset = "ISO8859_1";

            string connectionString = cs.ToString();
            logger.Debug(connectionString);

            IDbConnection dbcon = new FbConnection(connectionString);
            logger.Debug("Opening Connection.");

            dbcon.Open(); // crashes here.
            logger.Debug("Connection Opened");

            IDbCommand dbcmd = dbcon.CreateCommand();
            string sql = "SELECT
CONTACTS.CONTACTS_KEY,CONTACTS.NAME,CONTACTS.PIN
FROM CONTACTS where CONTACT_TYPE = 0";
            logger.Debug("Assigning SQL");

            dbcmd.CommandText = sql;
            logger.Debug("ExecuteReader");

            IDataReader reader = dbcmd.ExecuteReader();
            logger.Debug("Reading");

            while(reader.Read()) {
                Staff StaffMember = new Staff();

                StaffMember.ID = reader.GetInt32(0);
                StaffMember.Name = reader.GetString(1);

                StaffMember.PIN = reader.GetString(2);
                StaffList.Add(StaffMember);
            }
            // clean up
            reader.Close();
            reader = null;
            dbcmd.Dispose();
            dbcmd = null;
            dbcon.Close();
            dbcon = null;

When try and connect to it in code I get the following error.
// My Nlog output see code.
 MonoMethod.InternalInvoke => MainWindow.OnClick => XMLCache.buildStaff
building Staff

// My Nlog output see code.
 MainWindow.OnClick => XMLCache.buildStaff =>
DBMenuMate.HDServer.IData.getStaff Connecting to DB.

// My Nlog output see code.
 MainWindow.OnClick => XMLCache.buildStaff =>
DBMenuMate.HDServer.IData.getStaff data source=localhost;initial
catalog=/var/db/menumate.fdb;user
id=SYSDBA;password=masterkey;dialect=3;port number=3050;character
set=ISO8859_1

// My Nlog output see code.
 MainWindow.OnClick => XMLCache.buildStaff =>
DBMenuMate.HDServer.IData.getStaff Opening Connection.

Marshaling clicked signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to
handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by
the target of an invocation. ---> System.TypeInitializationException: An
exception was thrown by the type initializer for
FirebirdSql.Data.Common.Charset ---> System.ArgumentException: Encoding name
'shift_jis' not supported
Parameter name: name
  at System.Text.Encoding.GetEncoding (System.String name) [0x000ee] in
/build/buildd/mono-2.4.2.3+dfsg/mcs/class/corlib/System.Text/Encoding.cs:702

  at FirebirdSql.Data.Common.Charset.GetEncoding () [0x00000]
  at FirebirdSql.Data.Common.Charset..ctor (Int32 id, System.String name,
Int32 bytesPerCharacter, System.String systemName) [0x00000]
  at FirebirdSql.Data.Common.Charset.InitializeSupportedCharsets ()
[0x00000]
  at FirebirdSql.Data.Common.Charset..cctor () [0x00000]
  --- End of inner exception stack trace ---
  at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect ()
[0x00000]
  at (wrapper remoting-invoke-with-check)
FirebirdSql.Data.FirebirdClient.FbConnectionInternal:Connect ()
  at FirebirdSql.Data.FirebirdClient.FbConnectionPool.Create () [0x00000]
  at FirebirdSql.Data.FirebirdClient.FbConnectionPool.CheckOut () [0x00000]
  at (wrapper remoting-invoke-with-check)
FirebirdSql.Data.FirebirdClient.FbConnectionPool:CheckOut ()
  at FirebirdSql.Data.FirebirdClient.FbConnection.Open () [0x00000]
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00071] in
/build/buildd/mono-2.4.2.3+dfsg/mcs/class/corlib/System.Reflection/MonoMethod.cs:169

  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[]
parameters) [0x00000] in
/build/buildd/mono-2.4.2.3+dfsg/mcs/class/corlib/System.Reflection/MethodBase.cs:111

  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000b9] in
/build/buildd/mono-2.4.2.3+dfsg/mcs/class/corlib/System/Delegate.cs:430
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args)
[0x00018] in
/build/buildd/mono-2.4.2.3+dfsg/mcs/class/corlib/System/MulticastDelegate.cs:71

  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in
/build/buildd/mono-2.4.2.3+dfsg/mcs/class/corlib/System/Delegate.cs:402
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs
args) [0x00000]
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000]
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr
return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr
invocation_hint, IntPtr marshal_data) [0x00000]
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e,
Boolean is_terminal)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr
return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr
invocation_hint, IntPtr marshal_data)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at HDServer.MainClass.Main(System.String[] args) in
/home/michael/dev/POSBuddy/HandDroid/HDServer/HDServer/Main.cs:line 13


Mono JIT compiler version 2.4.2.3 (Debian 2.4.2.3+dfsg-2)
FirebirdClient-2.5.1-MONO_LINUX.7z
LI-V2.1.2.18118 Firebird 2.1

If anyone has any hints or tips that would be great!

Michael
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to