public static edu.isi.sdbc.Connection connectToDatabase(LogicObject database) {
    { Stella_Object protocol = Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_PROTOCOL);
      Stella_Object servertype = Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_SERVER_TYPE);
      Stella_Object host = Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_HOST);
      Stella_Object port = Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_PORT);
      Stella_Object user = Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_USER);
      Stella_Object password = Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_PASSWORD);
      Stella_Object dbname = Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_DB_NAME);

      { Stella_Object temp000 = Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_JDBC_CONNECTION_STRING);

        { Stella_Object connectionstring = ((temp000 != null) ? temp000 : Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_CONNECTION_STRING));
          Stella_Object dsn = Logic.accessBinaryValue(database, RDBMS.SGT_RDBMS_DSN);
          edu.isi.sdbc.Connection connection = null;
          ConnectionWrapper connectionwrapper = ConnectionWrapper.newConnectionWrapper();

          connection = edu.isi.sdbc.Sdbc.connect(Cons.cons(RDBMS.KWD_PROTOCOL, Cons.cons(RDBMS.normalizeConnectionArgument(protocol), Cons.cons(RDBMS.KWD_SERVER_TYPE, Cons.cons(RDBMS.normalizeConnectionArgument(servertype), Cons.cons(RDBMS.KWD_DSN, Cons.cons(RDBMS.normalizeConnectionArgument(dsn), Cons.cons(RDBMS.KWD_DB_NAME, Cons.cons(RDBMS.normalizeConnectionArgument(dbname), Cons.cons(RDBMS.KWD_USER, Cons.cons(RDBMS.normalizeConnectionArgument(user), Cons.cons(RDBMS.KWD_PASSWORD, Cons.cons(RDBMS.normalizeConnectionArgument(password), Cons.cons(RDBMS.KWD_HOST, Cons.cons(RDBMS.normalizeConnectionArgument(host), Cons.cons(RDBMS.KWD_PORT, Cons.cons(RDBMS.normalizeConnectionArgument(port), Cons.cons(RDBMS.KWD_CONNECTION_STRING, Cons.cons(RDBMS.normalizeConnectionArgument(connectionstring), Stella.NIL)))))))))))))))))));
          connectionwrapper.wrapperValue = connection;
          { Object old$Module$000 = Stella.$MODULE$.get();
            Object old$Context$000 = Stella.$CONTEXT$.get();

            try {
              Native.setSpecial(Stella.$MODULE$, ((Context)(Stella.$CONTEXT$.get())).baseModule);
              Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
              { Object old$InvisibleassertionP$000 = Logic.$INVISIBLEASSERTIONp$.get();

                try {
                  Native.setBooleanSpecial(Logic.$INVISIBLEASSERTIONp$, true);
                  edu.isi.powerloom.PLI.assertNaryProposition(Cons.cons(Logic.getRelation(RDBMS.SGT_RDBMS_DB_CONNECTION), Cons.cons(database, Cons.cons(connectionwrapper, Stella.NIL))), null, null);

                } finally {
                  Logic.$INVISIBLEASSERTIONp$.set(old$InvisibleassertionP$000);
                }
              }

            } finally {
              Stella.$CONTEXT$.set(old$Context$000);
              Stella.$MODULE$.set(old$Module$000);
            }
          }
          return (connection);
        }
      }
    }
  }