hi friends, what all i want is what query should i fire to get all the object names like tables,vies etc in a database. in oracle it is "select * from cat" or "select * from tab" but I want to know the exact query for MS-access or SQL-server. thanks in advance.
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
I would suggest a visit to the Microsoft online documentation to see what they call their system tables.
hi harjit, i think i can try helping u There is this method called getMetaData() in Connection interface that gives you info about the database. call this method.This returns an object of DatabaseMetaData . just say, DatabaseMetaData dmeta= con.getMetaData(); //con in of Connection The method getTables of DtabaseMetaData gives all the objects associated with a specific database Say, ResultSet rs= dmets.getTables(null,null,"%",null) where the paramter 1 represesnts the schema 2 represents the catalog 3 represents the patterns of table desired 4 represents the types of tables(system,view,general etc then iterate thru the resultset as usual and using the getSrting(n) where n is the column number get the appropriate name of the object. this should do.and i hope i have solved your problem And people,please free to correct me,if i'am wrong. seema kamath
Amit Manurkar
Greenhorn
Joined: Apr 03, 2003
Posts: 11
posted
0
Hey Folks, First of all thanks a lot for this post of yours, it helped me a lot. I would like to know if you have any idea about this - I want to query the system tables directly e.g "MSysRelationships" how can I do that ? I tried to query the tables directly using the "executeQuery()" method of the "Statement" object, but it does not allow me to access System tables.
Amit Manurkar
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: want toknow all the object names in a database