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 > Database Connection does not exist

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-22-12, 17:45
vivektietsood vivektietsood is offline
Registered User
 
Join Date: Jan 2012
Posts: 5
Database Connection does not exist

Hi, This my sound like a very novice question. Am trying to import xls sheet into DB 2 from CLP. Running syntax "import from testrun.xls of del insert import run" returns the error db connection does not exist. Can someone plz help me with this ? I hv DB 2 and the file I want to import (testrun.xls) on same machine, so I thought that this problem should not exit.
Reply With Quote
  #2 (permalink)  
Old 01-22-12, 19:51
tonkuma tonkuma is online now
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
Have you issued CONNECT command before running IMPORT command?
Reply With Quote
  #3 (permalink)  
Old 01-22-12, 21:24
vivektietsood vivektietsood is offline
Registered User
 
Join Date: Jan 2012
Posts: 5
Database Connection does not exist

Thanks for your reply. I connceted to database successfully and then tried using command "import from testrun.csv of del insert into Test". It now shows an error "Can not find input file. 0 rows were read from input file". I have some data in testrun so not sure why it cant read it. Can this be because of the reason that I need to give a complete path of where testrun exists? Reply much appreciated... .I am just starting up with DB 2, so stumbling my way through.
Reply With Quote
  #4 (permalink)  
Old 01-22-12, 22:43
tonkuma tonkuma is online now
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
Quote:
... I need to give a complete path of where testrun exists?
Yes, I think so.

You may want to check where in directory were you by "quit".

Here are some examples.
(I'm sorry to be mixed English and Japanese.)
Note: Some lines were omitted.
Code:
db2 => connect to sample user db2admin using ********

   Database Connection Information

 Database server        = DB2/NT 9.7.5
 SQL authorization ID   = DB2ADMIN
 Local database alias   = SAMPLE

db2 => export to testrun.csv of del select * from department
SQL3104N  The Export utility is beginning to export data to file
"testrun.csv".

SQL3105N  The Export utility has finished exporting "9" rows.


Number of rows exported: 9

db2 => quit
DB20000I  The QUIT command completed successfully.

D:\IBM\SQLLIB_V97\BIN>dir *.csv
 ドライブ D のボリューム ラベルは DATA です
 ボリューム シリアル番号は 3F9F-A7B7 です

 D:\IBM\SQLLIB_V97\BIN のディレクトリ

2012/01/23  12:31               383 testrun.csv
               1 個のファイル                 383 バイト
               0 個のディレクトリ   4,088,479,744 バイトの空き領域

D:\IBM\SQLLIB_V97\BIN>db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 9.7.5

You can issue database manager commands and SQL statements from the command
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

...
...

db2 => SELECT COUNT(*) FROM department

1
-----------
          9

  1 record(s) selected.

db2 =>

Last edited by tonkuma; 01-22-12 at 23:17. Reason: Add more example.
Reply With Quote
  #5 (permalink)  
Old 01-29-12, 15:18
vivektietsood vivektietsood is offline
Registered User
 
Join Date: Jan 2012
Posts: 5
database connection does not exist

Hello All

first of all thank you again for your replies and I am sorry for responding late. I am now able to connect to DB 2 database (sample) and import data into it from an external source. I realized that I was not using the import command properly. Now I am using the following command "Import from like4.txt of del modified by coldel, insert into title". This imports the data correctly, however one thing I am still wondering about -- the above command demands that data to be imported is separted by commas which I have, but when I try to separate the data to be imported by tabs and run command "Import from like4.txt of del modified by " ", insert into title" it does not run.... any help here

Thanks again

Vivek
Reply With Quote
  #6 (permalink)  
Old 01-29-12, 15:36
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by vivektietsood View Post
Hello All

first of all thank you again for your replies and I am sorry for responding late. I am now able to connect to DB 2 database (sample) and import data into it from an external source. I realized that I was not using the import command properly. Now I am using the following command "Import from like4.txt of del modified by coldel, insert into title". This imports the data correctly, however one thing I am still wondering about -- the above command demands that data to be imported is separted by commas which I have, but when I try to separate the data to be imported by tabs and run command "Import from like4.txt of del modified by " ", insert into title" it does not run.... any help here

Thanks again

Vivek
You need to look at the documentation on the import command. There are many options that are available, and chances are you will not be able to guess what they are, or how to use them, without reading the documentation.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390

Last edited by Marcus_A; 01-29-12 at 18:09.
Reply With Quote
  #7 (permalink)  
Old 01-29-12, 16:47
vivektietsood vivektietsood is offline
Registered User
 
Join Date: Jan 2012
Posts: 5
thanks

ok thanks.... do you have any link to the documentation ?
Reply With Quote
  #8 (permalink)  
Old 01-29-12, 19:46
vivektietsood vivektietsood is offline
Registered User
 
Join Date: Jan 2012
Posts: 5
Database connection does not exist

Hello

I could use the command "import from yes.txt of del modified by coldelx09 insert into title" and import a file separated by tabs....... thanks for your help and time

Thanks
Vivek
Reply With Quote
  #9 (permalink)  
Old 01-29-12, 22:59
tonkuma tonkuma is online now
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
Quote:
do you have any link to the documentation ?
IBM DB2® Version 9.7 for Linux®, UNIX®, and Windows® English manuals
Include links to PDF manuals and Information Center.

IBM DB2 9.7 for Linux, UNIX and Windows Information Center
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