If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > db to database creation problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-07-06, 06:01
lhrt lhrt is offline
Registered User
 
Join Date: Sep 2006
Posts: 6
db to database creation problem

hi,
i have created a database as

su - db2inst1
db2
CREATE DATABASE TEST
CONECT TO TEST

now i have to insert data from an sql file named test.sql
but when i do that using command

=>IMPORT FROM test.sql OF DEL INSERT INTO TEST
OR
=>LOAD FROM test.sql OF DEL INSERT INTO TEST

I always get an error as

SQL3304N The Table Does not exist.

can you help me to find where am i wrong?
thanks
bye
Reply With Quote
  #2 (permalink)  
Old 09-07-06, 06:07
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Exactly what it says - "The Table Does not exist"

You will have to create the table before you import from a del file ..
If you are using ixf you will be able to create the table from the source file

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 09-07-06, 06:25
lhrt lhrt is offline
Registered User
 
Join Date: Sep 2006
Posts: 6
actualy what i want is to insert data from that sql file ans its an ascii file

like create table sample (
id integer NOT NULL
keyword varchar(240) NOT NULL
);
Reply With Quote
  #4 (permalink)  
Old 09-07-06, 06:31
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
insert

the scenario would be
su - db2inst1
db2 create database anyname
db2 connect to anyname
db2 create table anytable (col1 char(xx), col2.....
db2 import from test.dta of del insert into anytable...
db2 connect reset
this is all..
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #5 (permalink)  
Old 09-07-06, 06:51
lhrt lhrt is offline
Registered User
 
Join Date: Sep 2006
Posts: 6
you mean i have to create all tables manually in that sql file?
Reply With Quote
  #6 (permalink)  
Old 09-07-06, 09:53
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
create

yes
each table to be filled with data by import has to exist
as indicated before : only if data was exported with ixf format you can
db2 import filename of ixf create into tablename
otherwise : insert into tablename and table should exist.
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #7 (permalink)  
Old 09-07-06, 12:25
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by lhrt
you mean i have to create all tables manually in that sql file?
If your script contains statements like "CREATE TABLE ..." you should run it like this:

"db2 -tvf yourscriptname.sql"

and it will create empty tables for you.

PS See, if you'd shown us your script in the beginning you'd get better answers right away.
Reply With Quote
  #8 (permalink)  
Old 09-08-06, 01:03
lhrt lhrt is offline
Registered User
 
Join Date: Sep 2006
Posts: 6
thanks guys.
but i can create tables from sql file
either usinf
db2 -tvf sample.sql
or
db2batch -d sampledatabase -f sample.sql

but when i tried to insert data to these tables from an sql file
that shows some error like

db2 -tvf data.sql throws error input is too long

db2batch -d sampledatabase -f data.sql gives error Bus error

by the way im using suse linux with db2 8.1
bye
thanks
Reply With Quote
  #9 (permalink)  
Old 09-14-06, 06:52
lhrt lhrt is offline
Registered User
 
Join Date: Sep 2006
Posts: 6
solved

db2 vf sampledata.sql works. dont use option "t".
thanks all
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On