Is there a way to retrieve a list of all database triggers using the
ODBC API?
I'm looking for something like SQLProcedures that can retrieve a list
of all database procedures.
Are triggers not supported by the ODBC catalog functions?
Why not'
I CANNOT use any database specific software such as the MS SQLServer
DMO object. Only the ODBC API functions."aRIEL" wrote...
> Is there a way to retrieve a list of all database
> triggers using the ODBC API?
> I'm looking for something like SQLProcedures that
> can retrieve a list of all database procedures.
> Are triggers not supported by the ODBC catalog functions?
> Why not'
In some cases you'll probably can't get anything comprehensible from it, as
not *all* databases support triggers.
> I CANNOT use any database specific software such
> as the MS SQLServer DMO object. Only the ODBC API functions.
Why? From a VB perspective you'd probably be better off using some OLE DB
provider, or something other possible to use in the concept of ADO. From
Java Perspective you'd be better off using thin JDBC-drivers instead of a
JDBC/ODBC-bridge...
Anyway...
Your actual question does not have much to do with some of the newsgroups
you've posted to.
Anyway, as one of the groups you've posted to is comp.lang.java.databases,
and I read your question there, I'll give you an answer from the Java
perspective.
I think what you search for could be accomplished in Java with the following
quick example:
// Open a connection to the database
Connection conn = DriverManager.getConnection(url);
// Get DatabaseMetaData
DatabaseMetaData dbmd = conn.getMetaData();
ResultSet proc = dbmd.getProcedures(null, null, "%");
// Printout data on stored procedures
while(proc.next())
{
String dbObjectCatalog = proc.getString(1);
String dbObjectSchema = proc.getString(2);
String dbObjectName = proc.getString(3);
String dbObjectRemarks = proc.getString(7);
String dbObjectType = proc.getString(8); // really a short, read the
docs
System.out.println("" + dbObjectType + ": " + dbObjectName);
System.out.println(" Catalog: " + dbObjectCatalog);
System.out.println(" Schema: " + dbObjectSchema);
System.out.println(" Remarks: " + dbObjectRemarks);
}
Note that you'll get all procedures, not only triggers, but that shouldn't
be so hard to figure out through the "type".
// Bjorn A
No comments:
Post a Comment