Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2012-10-01T15:16:05Z by ianbjor
SystemAdmin
SystemAdmin
5837 Posts
ACCEPTED ANSWER

Pinned topic How to invoke CLP in batch mode? What's wrong with my batch file?

‏2012-09-29T18:17:38Z |
Hi all,

I have installed db2 express v10.1 on linux platform. I'm begining to learn db2.

when I connect using clp and try creating a table it gives me error. So I guess i have to invoke clp using batch mode.

db2 -f /home/db2inst1/scripts/create_table_customer.clp

inside /home/db2inst1/scripts/create_table_customer.clp

connect to sample;
create table customer
(
CUSTOMER VARCHAR(80),
REGION CHAR(5),
PURCHASEDATE DATE
)
in sample

db2inst1@localhost ~$ db2 -f /home/db2inst1/scripts/create_table_customer.clp
SQL1001N "SAMPLE;" is not a valid database name. SQLSTATE=2E000

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

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

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

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

so I wonder what could be the solution?

thanks a lot!
Updated on 2012-10-01T15:16:05Z at 2012-10-01T15:16:05Z by ianbjor
  • ianbjor
    ianbjor
    75 Posts
    ACCEPTED ANSWER

    Re: How to invoke CLP in batch mode? What's wrong with my batch file?

    ‏2012-10-01T15:16:05Z  in response to SystemAdmin
    You need to include the -t flag in your call. This option tells the CLP that statements are terminated by a semicolon. Without this, CLP expects each statement to be on a single line.

    So,

    db2 -tf /home/db2inst1/scripts/create_table_customer.clp
    FYI, this page gives you more details about the available options for the CLP: http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0010410.html

    Good luck