Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2012
    Posts
    5

    Unanswered: 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.

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Have you issued CONNECT command before running IMPORT command?

  3. #3
    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.

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    ... 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-23-12 at 00:17. Reason: Add more example.

  5. #5
    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

  6. #6
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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.
    Last edited by Marcus_A; 01-29-12 at 19:09.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  7. #7
    Join Date
    Jan 2012
    Posts
    5

    thanks

    ok thanks.... do you have any link to the documentation ?

  8. #8
    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

  9. #9
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    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

  10. #10
    Join Date
    Dec 2013
    Posts
    1
    Dapigu vs. Xiaopigu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •