• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Getting trigger information usind JDBC API

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
How to get trigger information from the database using JDBC API calls. I need to retrieve the entire trigger and its related information from the database for some reason.
Any help will be appreciated
Regards,
<Mohan/>
 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any information available via system catalogs can be retrieved as long as the owner (DB User) through which u are obtaining your connection has the rights to do so.
At the end of the day, it is just a database call through a SQL Statement.
I cannot see why you cannot do it.
If you are having specific problems, please post.. and I might be able to tell something more..
best regards,
prasad.
 
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
Mohan,
I may be misinterpreting your question, but, as far as I know, there are no methods in the JDBC API for retrieving information about the database triggers.
Most [O]RDBMS's that support database triggers, store information about the triggers in their data dictionary. Each DBMS has its own proprietary data dictionary, but usually you can access the data dictionary using SQL. So, for example using Oracle, the following query will give you the trigger definition:

So you could "wrap" the above query into an invocation of the "executeQuery()" method in class "java.sql.Statement", for example, and get the informaton that way. However, as I mentioned before, each DBMS data dictionary is different, so the above will only work for Oracle. That's why there is nothing in the JDBC API for returning that information.
Good luck,
Avi.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All you need is the select role on catalog objects, to retrive the trigger information.
For eg. in Oracle you would use the following statement:-
select trigger_body from dba_triggers where trigger_name=<your trigger_name>
Thanks.
 
Sasparilla and fresh horses for all my men! You will see to it, won't you tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic