public void Open()
        {
            if (conn_str == null)
            {
                throw new InvalidOperationException("No database specified");
            }

            if (state != ConnectionState.Closed)
            {
                return;
            }

            IntPtr errmsg = IntPtr.Zero;

            /*
             *          if (Version == 2){
             *                  try {
             *                          sqlite_handle = Sqlite.sqlite_open(db_file, db_mode, out errmsg);
             *                          if (errmsg != IntPtr.Zero) {
             *                                  string msg = Marshal.PtrToStringAnsi (errmsg);
             *                                  Sqlite.sqliteFree (errmsg);
             *                                  throw new ApplicationException (msg);
             *                          }
             *                  } catch (DllNotFoundException) {
             *                          db_version = 3;
             *                  } catch (EntryPointNotFoundException) {
             *                          db_version = 3;
             *                  }
             *
             *                  if (busy_timeout != 0)
             *                          Sqlite.sqlite_busy_timeout (sqlite_handle, busy_timeout);
             *          }
             */
            if (Version == 3)
            {
                sqlite_handle = (IntPtr)1;
                var err = Sqlite3.Open(db_file, out sqlite_handle2);
                //int err = Sqlite.Open16(db_file, out sqlite_handle);
                if (err == Sqlite3.Result.Error)                 // SqliteError.ERROR)
                {
                    throw new ApplicationException(Sqlite3.GetErrmsg(sqlite_handle2));
                }
                //throw new ApplicationException (Marshal.PtrToStringUni( Sqlite.sqlite3_errmsg16 (sqlite_handle)));
                if (busy_timeout != 0)
                {
                    Sqlite3.BusyTimeout(sqlite_handle2, busy_timeout);
                }
                //Sqlite.sqlite3_busy_timeout (sqlite_handle, busy_timeout);
            }
            else
            {
            }
            state = ConnectionState.Open;
        }