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 > some dummy quesitons on DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-10, 04:44
cy163 cy163 is offline
Registered User
 
Join Date: Apr 2007
Posts: 127
some dummy quesitons on DB2

Hi All,


I am totally new to DB2. I am sorry to disturbing you all with the following dummy questions

I wonder
(1) how to show all databases which have been created;
(2) how to show all tables given a database;
(3) please show me or recommend some code snippets on how to connect db2 database from JAVA applications.


Thanks
Reply With Quote
  #2 (permalink)  
Old 10-08-10, 06:13
Daniil.Monin Daniil.Monin is offline
Registered User
 
Join Date: Oct 2010
Posts: 19
Hello. I am not clever with a java, but i try to help you.

(1) how to show all databases which have been created;
Using db2api. Or some analog in java, i guess.

(2) how to show all tables given a database;

Connect to database and run:
Quote:
select NAME, CREATOR from sysibm.systables
Remeber, this script shows you system tables too.

(3) please show me or recommend some code snippets on how to connect db2 database from JAVA applications.
Basic steps
Reply With Quote
  #3 (permalink)  
Old 10-08-10, 07:27
DB2Plus DB2Plus is offline
Registered User
 
Join Date: Jul 2009
Posts: 150
Arrow

If you don't want watch the system table names, use the query:

Code:
select tb.* 
from sysibm.systables tb
where NOT 
tb.name like 'SYSIBM.%'
Kara
Reply With Quote
  #4 (permalink)  
Old 10-08-10, 10:43
cy163 cy163 is offline
Registered User
 
Join Date: Apr 2007
Posts: 127
Thanks for your reply and help

Actually , I want to know whether there are command line commands at the 'db2' prompt to show all already created databases on a DB2 server
Reply With Quote
  #5 (permalink)  
Old 10-08-10, 14:32
Daniil.Monin Daniil.Monin is offline
Registered User
 
Join Date: Oct 2010
Posts: 19
Quote:
Originally Posted by cy163 View Post
Thanks for your reply and help

Actually , I want to know whether there are command line commands at the 'db2' prompt to show all already created databases on a DB2 server
You can use:

LIST DB DIRECTORY
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