Note: These steps update a project created using the Vertica 7.1.2 plug-in to work with 7.2 or 8.x. They do not change the Eclipse plug-in.
This blog assumes that you are developing your Java UDx on a system that has the targeted version of Vertica installed on it.
Here’s what you need to do to create an Eclipse UDx project compatible with newer versions of Vertica:
- Exit Eclipse if it is currently running.
- If you have not already installed the Vertica SDK Plug-in, save it in the Eclipse dropins folder. For example, if your installation of Eclipse is in your home directory’s /eclipse/java-neon directory, verify that you have the plug-in installed by using these commands:
# cd ~/eclipse/java-neon/eclipse/dropins
# ls -ltr
-rw-r–r– 1 root root 386182 Jan 4 12:39 com.vertica.sdk.eclipseplugin.v7.1.2.jar
- Launch Eclipse.
- Click New > Other.
- Verify that the Vertica 7.1.2 Java SDK plug-in is available within Eclipse:
- Select Vertica UDX Project and click Next.
- In the Project Name box, enter a name for your UDx project, for example Count Words.
- Click Finish.
- View your new project in the Project Explorer window.
- Expand the src and Referenced Library folders. Now you see the BuildInfo.java and VerticaSDK.jar files that are specific to Vertica version 7.1.2. These are the files that you must replace with the latest versions.
- Copy the file /opt/vertica/sdk/BuildInfo.java to your project’s /src/com/vertica/sdk/ directory. For example, if you are developing a UDx project named Count Words, use the following commands to copy the file:
# cp /opt/vertica/sdk/BuildInfo.java ~/eclipse/workspace/Count\ Words/src/com/vertica/sdk/BuildInfo.java
# ls -ltr ~/workspace/Count\ Words/src/com/vertica/sdk/BuildInfo.java
-rw-rw-r– 1 root root 1850 Jan 4 12:52 /root/eclipse/workspace/CountWords/src/com/vertica/sdk/BuildInfo.java
- 12. Copy both /opt/vertica/bin/VerticaSDK.jar and /opt/vertica/sdk/BuildInfo.java to the directory where the VerticaSDK.jar file is currently installed. You find this path by looking at the VerticaSDK.jar entry under the Reference Libraries folder in the Project Explorer.
- Now you are ready to build a Java UDx to work with an installed Vertica version such as 7.2.3-9. The steps discussed in this method also work with 8.x.
dbadmin=> select version();
Vertica Analytic Database v7.2.3-9
dbadmin=> CREATE LIBRARY wordCountLib AS ‘/tmp/CountWordsUDxLib.jar’ LANGUAGE ‘Java’;
For more information, see Developing UDx in Java Tutorial Part 1: Introduction and Setting Up.