Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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().
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic