Object pgconn = ((com.caucho.sql.UserConnection) userconn).getConnection();
Object pgconn = ((UserConnection) userconn).getConnection();
  public static Integer pg_lo_create(Env env,                                     @Optional Postgres conn)  {    try {      int oid = -1;      if (conn == null)        conn = getConnection(env);      // LargeObjectManager lobManager;      Object lobManager;      // org.postgresql.PGConnection      Class cl = Class.forName("org.postgresql.PGConnection");      Method method = cl.getDeclaredMethod("getLargeObjectAPI", null);      Object userconn = conn.getConnection();      Object pgconn = ((com.caucho.sql.UserConnection) userconn).getConnection();      // Large Objects may not be used in auto-commit mode.      ((java.sql.Connection)pgconn).setAutoCommit(false);      lobManager = method.invoke(pgconn, new Object[] {});      // lobManager = ((org.postgresql.PGConnection)conn).getLargeObjectAPI();      // org.postgresql.largeobject.LargeObjectManager      cl = Class.forName("org.postgresql.largeobject.LargeObjectManager");      method = cl.getDeclaredMethod("create", null);      Object oidObj = method.invoke(lobManager, new Object[] {});      oid = Integer.parseInt(oidObj.toString());      // oid = lobManager.create();      return new Integer(oid);    } catch (Exception ex) {      log.log(Level.FINE, ex.toString(), ex);      return null;    }  }