Results 1 to 11 of 11

Thread: Error

  1. #1
    Join Date
    Jun 2006
    Posts
    13

    Unanswered: Error

    Iam getting error when i run the following statement
    db2 -tvf file name
    the error is as follows
    SQL0104N An unexpected token "db2" was found following "BEGIN-OF-STATEMENT"
    Expected tokens may include: "SELECT". SQLSTATE=42601
    provide me solution

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    You are probably in the DB2 Command Line Processor (not the DB2 Command Window). When using the Command Line Processor you exclude the "db2" keyword. You can type "quit" to exit the Command Line Processor and then you can use the "db2" command.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Jun 2006
    Posts
    13

    error

    Thanks Marcus for providing me the solution.but still iam getting error,if i quit & if i give the statement
    db2 -tvf My Documents\ee
    follows error
    DB21004E You cannot specify both an input file and a command when invokin
    the Command Line Processor.
    I tried other thing also
    after quiting db2
    again i tried db2 then i gave
    -tvf My Documents\ee
    iam getting error as follow
    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL0007N The character "\" following "-tvf My Documents" is not valid.
    SQLSTATE=42601

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    I am not sure you can use a path name with blanks. Try cd to the path name where the file is located and then just reference the file name in your command.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  5. #5
    Join Date
    Jun 2006
    Posts
    13

    Error

    Thanks a lot Marcus.
    i tried by replacing the file in D folder
    statement is
    C:\>db2 -tvf D:\ee
    error is
    DB21005E An error occurred while accessing the file D:\ee

  6. #6
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Change the directory to the path were the file is. Then issue the DB2 command with the file name only, excluding the drive and path (since you should already be at that directory).

    If you still have problems, get someone who understands Windows to help you.
    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
    Jun 2006
    Posts
    13

    Error

    Marcus once more my gratitude.
    i changed the directory
    D:\>db2 -tvf ee.txt
    but showing error
    create table ee ( idnum numeric(10), name varchar(10), address varchar(1
    0), statusid numeric(10) )
    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL1024N A database connection does not exist. SQLSTATE=08003
    Help me

  8. #8
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    put this as the first line in your script (assuming your database name is sample):

    connect to sample;

    make sure you have a ";" after every SQL statement.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  9. #9
    Join Date
    Jun 2006
    Posts
    13

    Error

    Marcus i did as u said,but the error as follows
    D:\>db2 -tvf ee.txt
    connect to vts user brindha using create table ee ( idnum numeric(10)
    , name varchar(10), address varchar(10), statusid numeric(10) )
    SQL0104N An unexpected token "create" was found following "<identifier>".
    Expected tokens may include: "NEW". SQLSTATE=42601
    actually in our organisation we no need to give ";" after SQL statement they set like that in command prompt.

  10. #10
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by brindha
    Marcus i did as u said
    No, you did not do as I said.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  11. #11
    Join Date
    Jun 2006
    Posts
    13

    Error

    Thanks...
    my error has been corrected.
    I had made some simple mistakes.
    now my statement is executing

Posting Permissions

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