Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / October 2005

Tip: Looking for answers? Try searching our database.

ODBC API: How to get list of database triggers?

Thread view: 
aRIEL - 12 Oct 2005 08:09 GMT
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.
Bjorn Abelli - 14 Oct 2005 02:08 GMT
"aRIEL" wrote...

> Is there a way to retrieve a list of all database
> triggers using the ODBC API?
[quoted text clipped - 4 lines]
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.