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 > Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-13-06, 01:24
brindha brindha is offline
Registered User
 
Join Date: Jun 2006
Posts: 13
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
Reply With Quote
  #2 (permalink)  
Old 06-13-06, 01:28
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #3 (permalink)  
Old 06-13-06, 01:39
brindha brindha is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 06-13-06, 02:39
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #5 (permalink)  
Old 06-13-06, 03:00
brindha brindha is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 06-13-06, 04:02
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #7 (permalink)  
Old 06-13-06, 06:03
brindha brindha is offline
Registered User
 
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
Reply With Quote
  #8 (permalink)  
Old 06-13-06, 10:47
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #9 (permalink)  
Old 06-14-06, 04:01
brindha brindha is offline
Registered User
 
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.
Reply With Quote
  #10 (permalink)  
Old 06-14-06, 04:33
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #11 (permalink)  
Old 06-19-06, 03:48
brindha brindha is offline
Registered User
 
Join Date: Jun 2006
Posts: 13
Error

Thanks...
my error has been corrected.
I had made some simple mistakes.
now my statement is executing
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