Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / IBM DB2, WebSphere, IMS, U2 [игнор отключен] [закрыт для гостей] / Как записать XLS файл (именно файл!) в базу DB2 / 7 сообщений из 7, страница 1 из 1
24.07.2012, 08:28
    #37889970
vadipok
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Как записать XLS файл (именно файл!) в базу DB2
Добрый день коллеги!
Подскажите пожалуйста как это сделать, если это вообще можно сделать.
Доку перерыл, погуглил, не помогло.

База DB2 9.7,
файлик /tmp/color.xls
Версия ОС Linux version 2.6.18-238.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48))

Спасибо за помощь!
...
Рейтинг: 0 / 0
24.07.2012, 10:14
    #37890071
Troglodit
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Как записать XLS файл (именно файл!) в базу DB2
есть тип данных BLOB, если xls сохраняется в xml формате, то можно записываеть его в xml тип поле.
...
Рейтинг: 0 / 0
24.07.2012, 10:30
    #37890095
Mark Barinstein
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Как записать XLS файл (именно файл!) в базу DB2
vadipok,

Здравствуйте.

Создайте файл /tmp/color.csv с 1-й строкой:
"color.xls"

Если у вас есть таблица my_table с полем b типа blob, то при соединении с базой выполните:

Код: plaintext
import from /tmp/color.csv of del lobs from /tmp insert into my_table (b)
...
Рейтинг: 0 / 0
24.07.2012, 10:50
    #37890133
vadipok
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Как записать XLS файл (именно файл!) в базу DB2
Mark Barinstein,

Спасибо огромное коллеги.
Выбирал метод Mark Barinstein.

Очень помогли. )
...
Рейтинг: 0 / 0
26.07.2012, 13:52
    #37893786
vadipok
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Как записать XLS файл (именно файл!) в базу DB2
Mark Barinsteinvadipok,

Здравствуйте.

Создайте файл /tmp/color.csv с 1-й строкой:
"color.xls"

Если у вас есть таблица my_table с полем b типа blob, то при соединении с базой выполните:

Код: plaintext
import from /tmp/color.csv of del lobs from /tmp insert into my_table (b)



Добрый день!
Для поля типа Clob эта команда хорошо работает, но как только меняю тип поля на Blob выводит вот такую ошибку:


$ db2 "import from /tmp/color of del lobs from /tmp insert into portal_kich_fpk.clob_test3 (my_blob)"
SQL3109N The utility is beginning to load data from file "/tmp/color".

SQL3148W A row from the input file was not inserted into the table. SQLCODE
"-668" was returned.

SQL0668N Operation not allowed for reason code "7" on table
"PORTAL_KICH_FPK.CLOB_TEST3". SQLSTATE=57016

SQL3185W The previous error occurred while processing data from row "1" of
the input file.

SQL3110N The utility has completed processing. "1" rows were read from the
input file.

SQL3221W ...Begin COMMIT WORK. Input Record Count = "1".

SQL3222W ...COMMIT of any database changes was successful.

SQL3149N "1" rows were processed from the input file. "0" rows were
successfully inserted into the table. "1" rows were rejected.


Number of rows read = 1
Number of rows skipped = 0
Number of rows inserted = 0
Number of rows updated = 0
Number of rows rejected = 1
Number of rows committed = 1

Почему так? Объясните пожалуйста.
...
Рейтинг: 0 / 0
26.07.2012, 14:16
    #37893834
Mark Barinstein
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Как записать XLS файл (именно файл!) в базу DB2
vadipok...
SQL3148W A row from the input file was not inserted into the table. SQLCODE
"-668" was returned.

SQL0668N Operation not allowed for reason code "7" on table
"PORTAL_KICH_FPK.CLOB_TEST3". SQLSTATE=57016
...

db2 "? SQL0668N"

SQL0668N Operation not allowed for reason code "<reason-code>" on table
"<table-name>".

Explanation:

Access to table "<table-name>" is restricted. The cause is based on the
following reason codes "<reason-code>":

...
7

The table is in the reorg pending state. This can occur after
an ALTER TABLE statement containing a REORG-recommended
operation.
...
User response:
...
7

Reorganize the table using the REORG TABLE command.
...
После изменения типа поля как у вас надо делать реорганизацию таблицы, чтоб в нее можно было писАть.
...
Рейтинг: 0 / 0
26.07.2012, 14:25
    #37893854
vadipok
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Как записать XLS файл (именно файл!) в базу DB2
Mark Barinsteinvadipok...
SQL3148W A row from the input file was not inserted into the table. SQLCODE
"-668" was returned.

SQL0668N Operation not allowed for reason code "7" on table
"PORTAL_KICH_FPK.CLOB_TEST3". SQLSTATE=57016
...

+
db2 "? SQL0668N"

SQL0668N Operation not allowed for reason code "<reason-code>" on table
"<table-name>".

Explanation:

Access to table "<table-name>" is restricted. The cause is based on the
following reason codes "<reason-code>":

...
7

The table is in the reorg pending state. This can occur after
an ALTER TABLE statement containing a REORG-recommended
operation.
...
User response:
...
7

Reorganize the table using the REORG TABLE command.
...
После изменения типа поля как у вас надо делать реорганизацию таблицы, чтоб в нее можно было писАть.


Все отлично! Спасибо большое!
...
Рейтинг: 0 / 0
Форумы / IBM DB2, WebSphere, IMS, U2 [игнор отключен] [закрыт для гостей] / Как записать XLS файл (именно файл!) в базу DB2 / 7 сообщений из 7, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]