Message-ID: <56DC9478.1000700@anastigmatix.net> Date: Sun, 06 Mar 2016 15:35:04 -0500 From: Chapman Flack MIME-Version: 1.0 References: <56DBC5E4.6050301@lucee.org> <56DBDAFA.2070106@anastigmatix.net> <56DC8056.5090905@lucee.org> In-Reply-To: <56DC8056.5090905@lucee.org> Subject: Re: [Pljava-dev] Video Tutorial - How to Build and Install PL/Java Content-Type: text/plain; charset="us-ascii" On 03/06/16 14:09, Igal @ Lucee.org wrote: > did you see my pull request at https://github.com/tada/pljava/pull/97/files ? I did. I mean to pull it into both master and REL1_5_STABLE (so it will be in 1.5) and I'll have to do that the old-fashioned git way, I can't just use the big green button on github. :) >> (I think the saved value is the same as the one you gave in the SET >> command, otherwise that command would have failed ... it doesn't >> let you change libjvm_location in a session where the jvm has already >> loaded, because it would be too late to make any difference to that >> session.) > while playing with this before I tried both ALTER DATABASE and ALTER SYSTEM > to set that value. unfortunately I was unable to UN-SET that value? I > tried ALTER - RESET > but that didn't seem to work Hmm, that's puzzling. You could start with select name, source from pg_settings where name like 'pljava.%' order by source; to see exactly where it thinks it got the value. If the source is 'database' then ALTER DATABASE ... RESET ... ought to work, if it is coming from ALTER SYSTEM I guess it would say 'configuration file' and ALTER SYSTEM RESET ... ought to work. After doing an ALTER DATABASE ... RESET ... you would need a \c in psql to start a new session; after an ALTER SYSTEM RESET ... you would need a pg_ctl reload (and start a new session). > so you want me to show the "pitfalls" and troubleshooting? I want to keep > the video > rather short. replacing git with download can save some time so it might be > offset, > but I really prefer to keep the whole thing under 15 minutes I don't know how much time it would add, but if you showed CREATE EXTENSION before the libjvm_location was set, you could point out that the error message pretty much says "hey, you should set pljava.libjvm_location" and then you could show how to do that ... likewise, if you try calling an example function before setting the classpath, you can say "oh, here's what this ClassNotFoundException is telling us". I think people remember things better when they see why you are telling them. What you say about pljava.libjvm_location already takes nearly a full minute (6:22 to 7:18) but the viewer doesn't actually see why you are spending the time on it, because nothing failed. You could probably do a CREATE EXTENSION that failed, showing the error message implicating libjvm_location, find the jvm, set the variable, and show that it works, in roughly the same amount of time, and ... in my experience anyway ... it might stick better for the viewer that way. Now, there are two different ways you could show how to recover. One would be to just say "oh, I needed to set the JVM location, let's do ALTER DATABASE postgres SET pljava.libjvm_location TO '...', then start a new session with \c so it takes effect, THEN try CREATE EXTENSION again" and that would be a quick, tidy way to show it. The other way would be to demonstrate staying in the same session, showing how setting the variable correctly allows the installation to immediately complete, and the message reminds you to save the setting, do a \c and then the CREATE EXTENSION pljava FROM unpackaged; to finish the job. That's a little messier, so you may prefer to show the other way; I'm not sure which would really take longer on screen. > sure, I can show the local files instead of the github repo in the browser I wasn't necessarily suggesting to show the local files instead of the github browser ... a lot of the time I prefer to look at the github browser, it just colorizes them nicely and so on. But what I would suggest is this: instead of just going to https://github.com/tada/pljava and browsing around the files there (because that shows whatever happens to be in 'master' at this exact moment), show how to start at https://github.com/tada/pljava/releases and then click the tag link for the release you have installed (say V1_5_0b2) and *then* browse around the files there. > 1) how do I unset the value tried to cover that above ... > 2) where are the docs for the `sqlj` namespace (or is it a schema?), for Just for fun, PostgreSQL uses the terms 'namespace' and 'schema' interchangeably. > example, what do the additional args do exactly? Couple of places for that info: the wiki: https://github.com/tada/pljava/wiki/SQL-functions and the javadocs: http://tada.github.io/pljava/pljava/apidocs/index.html?org/postgresql/pljava/management/Commands.html They should pretty much agree. :) > SELECT > sqlj.install_jar('file:/C:/Apps/pgsql951/share/pljava/pljava-examples-1.5.0-BETA2.jar', > 'examples', true); The first argument is of course what this jar file is called outside of PostgreSQL. The second argument ('examples') is what it will be called inside PostgreSQL once it is installed. The boolean argument is whether PL/Java should execute the commands in the jar's DDR files after installing the jar. Passing true means it does, so all the necessary SQL commands get executed. > and this one? creates a schema named javatest and maps it to the 'examples' > namespace from the previous command? > > SELECT sqlj.set_classpath('javatest', 'examples'); Well, from the previous command, 'examples' is what you named the jar file you just installed. 'javatest' is the name of a schema that all the example functions got declared in (all of that was done by the DDR commands when the jar was installed, including creating the schema 'javatest' itself; you can see that as the first install command in examples.ddr. So the only thing left to do is tell PL/Java "when you are looking up functions that are declared in the schema 'javatest', look for them in the jar named 'examples'." That's what this command does. -Chap _______________________________________________ Pljava-dev mailing list Pljava-dev@lists.pgfoundry.org http://lists.pgfoundry.org/mailman/listinfo/pljava-dev