aspose file tools*
The moose likes JDBC and the fly likes Using Java How to find a List of tablespaces in a database(Oracle,DB2,MSSQL) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using Java How to find a List of tablespaces in a database(Oracle,DB2,MSSQL)" Watch "Using Java How to find a List of tablespaces in a database(Oracle,DB2,MSSQL)" New topic
Author

Using Java How to find a List of tablespaces in a database(Oracle,DB2,MSSQL)

dbala subramaniam
Ranch Hand

Joined: Jul 20, 2003
Posts: 73
High I want to know how to get the tablespace in database
I need to get the List of table and their tablespaces
in a database (Oracle,DB2,MSSQL)
if anybody know how to get using Java-JDBC please help me
Advance thanks
with regards
bala
shilpa mshilpa
Greenhorn

Joined: May 26, 2004
Posts: 1
hi,
i have created tables in ms access and connected using jdbc and worked on
it using jsp. well creating tables in ms access is quite easy.And for
connectivity you just have to include your database name inthe odbc data
source administator inthe control panel being a sysem DSN and the driver
select it as the ms access driver(*mdb).
bye.
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1132

Bala,
If I am not mistaken, different DBMS's define "tablespace" in different ways. In any case, as far as I know, there is nothing in the JDBC API that will return the "tablespace" names. Of-course, you can get the table names via the "getTables()" method of the "java.sql.DatabaseMetaData" interface.

If you really want the "tablespace" names, then I think you will have to directly query the data dictionary of the DBMS you are working with. Naturally, the query will vary between different DBMS's. With Oracle, you can query the ALL_TABLES view, which holds both the table name as well as the tablespace name. Since I don't work with the other DBMS's you mentioned, I can't tell you how to locate the relevant information in their data dictionaries (sorry).

Good Luck,
Avi.
Loren Rosen
Ranch Hand

Joined: Feb 12, 2003
Posts: 156
The jdbc DatabaseMetaData class has some likely relevant methods:
getCatalogs()
getCatalogSeparate()
getCatalogTerm()
getSchema()
getSchemaTerm()
getMaxCatalogNameLength()
getMaxSchemaNameLength()

Precisely what these mean is left a little vague, probably deliberately so, since the different DMBS's deal with scoping differently. I'd take a look through the docs for the various JDBC drivers.

The actual catalog and schema names are then used as paramaters to methods like getTables().
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Java How to find a List of tablespaces in a database(Oracle,DB2,MSSQL)