English 中文(简体)
BLOBs从一个行到另一个行
原标题:Reading BLOBs from one DB to another

我正试图从一个我的板块移至一个后方,我遇到麻烦的一个领域是我的q。 我正试图把它带入大目标型号,而Im则有一些速度问题。 我在 Java/Groovy这样做,坦率地说,主流企业使我感到困惑。

我尝试了两种办法: HolLBLOB,并直接写给联络处,将LBLOB写到软盘上(毕竟是档案),然后在联络处读到档案。

第二种做法是多次加快的,我可以说明为什么,因为我认为这种做法仍然过于缓慢。

这是第一个办法。

InputStream ins = rs.getBinaryStream(1);
def b
while ((b = ins.read()) > -1) {
    obj.write(b.toInteger().byteValue())
}

“斜面”是拜特阿雷拉射线,因此,我读到(直线)中,然后写到“obj”,即联络处。 1MB档案大约需要7分钟。 我的格言告诉我,这应当比第二次更有效率,但不是这样。

我将密码的刀切放在文件上,但很基本。 它用同样方式读取,但随后将产出写到磁盘上。 然后,我从磁盘读到文件,然后写到联络处。 这种做法涉及同一档案的大约8秒钟。

正在发生什么?

最佳回答
obj.write(b.toInteger().byteValue())

这种做法非常有效。

缓冲I/O:

  public void drain(InputStream in, OutputStream out) throws IOException {
    byte[] buffer = new byte[1024];
    int r;
    while ((r = in.read(buffer)) > -1) {
      out.write(buffer, 0, r);
    }
  }

酌情保持缓冲规模。

如果卷宗数量庞大,你可能会看到操作系统存在问题,进行磁盘扫描(光盘I/O,加上记忆管理)。 从互联网的到此,很难说话。 跟踪和比较这两种方法(仅最低限度,可使用-Xprof 指挥线交换

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签