Stored procedures in Java [closed]
I am new to store p开发者_运维知识库rocedure, I know how to call it, but where do I write the store procedure in my application, in my Java file or somewhere else?
Stored procedures are stored in database. They are integrated with database service. You can find more on Wikipedia: http://en.wikipedia.org/wiki/Stored_procedure
Some vendors offers Java as a language for such procedures, but they can be written in other languages: Oracle uses PL/SQL, PostgreSQL uses PL/pgSQL, PL/Java, PL/Python and others. For PostgreSQL have a look at: http://www.postgresql.org/docs/9.0/interactive/server-programming.html
As for location of sources: to me stored procedures are part of application. I save them with other sources, they are stored in Subversion (or other version control system). But after they are deployed to database server they became part of this service. Upgrading such procedure is database specific. For example Informix has:
execute procedure replace_jar(
"file:$INFORMIXDIR/extend/jars/mytools.jar",
"mytools_jar");
While procedure for Oracle in PL/SQL can be replaced with:
create or replace function naznk_errs(p_naznk in varchar)
....
精彩评论