JavaRush /Java Blog /Random EN /Introduction to PostgreSQL PL/Java
FedoraLinux
Level 21
Москва

Introduction to PostgreSQL PL/Java

Published in the Random EN group
Holy shit, it’s still a bit complicated. This article is a translation of the article " Introduction to PostgeSQL PL/Java ". Modern databases support stored procedures written in various languages. I don't know how to translate this. Modern databases allow stored procedures to be written in a variety of languages. One commonly implemented language is java.NB, this article discusses the PostgreSQL-specific java implementation. The details will vary with other databases but the concepts will be the same. Installing PL/Java Installing PL/Java on Ubuntu is easy. I'll first create a new template, template_java, so that I can create databases without the PL/Java extension for now. Installation of PL/Java on an Ubuntu system is straightforward. I will first create a new template, template_java, so I can still create databases without the pl/java extensions. In the console as root, enter the following: # apt-get install postgresql-9.1 # apt-get install postgresql-9.1-pljava-gcj $ createdb template_java $ psql -d template_java -c 'update db_database set datistemplate='t' where datnam='template_java'' $ psql -d template_java -f /usr/share/postgresql-9.1-pljava/install.sql Limitations The packages built for Ubuntu use the GCJ Java implementation, not the standard OpenJDK or Sun JDK. GCJ compiles Java source files to native object codes instead of compiling to bytecode. The prepackaged Ubuntu package uses the Gnu GCJ java implementation, not a standard OpenJDK or Sun implementation. GCJ compiles java source files to native object code instead of byte code. The most recent versions of PL/Java are “trusted” – they can be relied upon to stay within their sandbox. Among other things this means that you can't access the filesystem on the server. If you must break the trust there is a second language, 'javaU', that can be used. Untrusted functions can only be created a the database superuser.
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION