wood burning stoves 2.0*
The moose likes JDBC and the fly likes execute query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "execute query" Watch "execute query" New topic
Author

execute query

mohamed mustaq
Greenhorn

Joined: Dec 19, 2005
Posts: 21
how to execute the
desc [tablename] ,
show user command in java
executeQuery is not working for the above commands.
thanks..
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

you can use DatabaseMetaData.getColumns to get columns info.
[ February 12, 2006: Message edited by: Satou kurinosuke ]

[My Blog]
All roads lead to JavaRanch
mohamed mustaq
Greenhorn

Joined: Dec 19, 2005
Posts: 21
thanks but i know how to get the column name and column type using databasemetadata.
but i am developing editor in java to run all sql queries like select,delete,insert and all.
its all working fine for me,but if i give the command like dec tablename ,
show user,rollback/
it wont work.
i think u understand what i am asking.
thanks ..
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

executeQuery cannot be used for such commands. It is used for queries only.
I don't think there is a simple way to process the user commands.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: execute query
 
Similar Threads
statement insertion problem
Threads and GC
Java Package
Doubt in nullpointerException.
Object : Cosmic Super Class