Author |
Message
|
james2005 |
Posted: Mon Dec 12, 2005 2:56 am Post subject: DB2 Issue |
|
|
Apprentice
Joined: 18 Sep 2005 Posts: 31
|
How to create database and all tables using sql file(example: ex.sql). Now i am copying all commands one by one into command editor. Pl tell me how and from where i have to run the .sql file.
Same issue with the script file to create queues.
Thanks in advance
James |
|
Back to top |
|
 |
wschutz |
Posted: Mon Dec 12, 2005 3:07 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
db2 < ex.sql
runmqsc < ex.mqsc _________________ -wayne |
|
Back to top |
|
 |
james2005 |
Posted: Tue Dec 13, 2005 10:57 pm Post subject: please tell me in detail |
|
|
Apprentice
Joined: 18 Sep 2005 Posts: 31
|
please tell me in detail, like from where i have to execute this commands.
I tried from command line, but getting problems.
i have one file called ex.sql which contains all commands to create database and tables.
when itried to execute this from commandline i got one message, 'DB21061E commandline environment not initialised'.
My file is in c: folder and i am trying the command from c:/ only.
Please tell me what i have to do now.
Regards,
James |
|
Back to top |
|
 |
fschofer |
Posted: Wed Dec 14, 2005 1:33 am Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
|
Back to top |
|
 |
vennela |
Posted: Wed Dec 14, 2005 9:55 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Open a DB2 Command window
You will see something like
Quote: |
C:\Program Files\IBM\SQLLIB\BIN> |
On the prompt you can give
Code: |
db2 -tf createDatabaseDb2.ddl |
If you have your file somewhere else, you can also CD to that directory and issue the command |
|
Back to top |
|
 |
james2005 |
Posted: Thu Dec 15, 2005 4:23 am Post subject: Thanks and one MQ prob |
|
|
Apprentice
Joined: 18 Sep 2005 Posts: 31
|
DB2 command is working. Thanks for this.
I want to execute a file containing all commands like define qlocal...
How and from where i have to. |
|
Back to top |
|
 |
wschutz |
Posted: Thu Dec 15, 2005 4:25 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Did you see this?
wschutz wrote: |
db2 < ex.sql
runmqsc < ex.mqsc |
_________________ -wayne |
|
Back to top |
|
 |
james2005 |
Posted: Sat Dec 17, 2005 12:55 am Post subject: Yes, Thanks |
|
|
Apprentice
Joined: 18 Sep 2005 Posts: 31
|
Hi,
Yes, I got. Thanks alot.
Regards,
Enda. |
|
Back to top |
|
 |
james2005 |
Posted: Sat Dec 17, 2005 1:00 am Post subject: Correct command to execute .sql file from db2 |
|
|
Apprentice
Joined: 18 Sep 2005 Posts: 31
|
Hi,
Correct command to execute .sql file from db2 command window is:
db2 -t -v -f example.sql.
Before this u have to connect to the database.
Using db2 connect to DB1. DB1 is the database name.
Thanks....
Enda. |
|
Back to top |
|
 |
|