How Do I Connect to a Rocket / U2 Database?

Ryan Carrie shared this question 1 year ago
Answered

I see this listed as a "Bring Your Own Driver" compatible database type, yet I'm having difficulties getting the JDBC Driver to work.

Specifically, I keep getting a java.lang.NoClassDefFoundError regarding asjava!

Comments (1)

photo
1

The short answer here is to make sure you set your CLASSPATH on the Yellowfin server, as per the U2 Technical Documentation page 11 - 12.

Setting the CLASSPATH for Yellowfin is fairly straightforward for most scenarios, and I'll go into this in more detail later in the article.

The first thing is to ensure you have the unijdbc.jar file and the asjava.zip file from the Client Tools installation. The unijdbc.jar file you'll want to upload through the Plugin Manager just as any other typical jdbc driver, see this article for more info.

Next, you need to ensure the asjava.zip file included in your Client Tools install (from Rocket) is in your Yellowfin CLASSPATH.

In Linux / Unix -

You'll want to create a setenv.sh file within <YellowfinInstall>/appserver/bin. This should include your CLASSPATH, declared as such:

export
CLASSPATH=/unishared/jdbc/lib/unijdbc.jar:/unishared/jdbc/lib/asjava.zip:$CLASSPATH
Note that this is based on a default installation and should be evaluated whether this successfully points to the file on the Yellowfin server! It may be enough to upload both files to the <YellowfinInstall>/appserver/webapps/ROOT/WEB-INF/lib/ folder and point to that in the CLASSPATH.

Upon restart, Yellowfin will pick up the CLASSPATH variable set in the setenv.sh file.

Windows -

You'll want to create a setenv.bat file within <YellowfinInstall>/appserver/bin. This will set your CLASSPATH as follows:

set CLASSPATH=C:\U2\UniDK\jdbc\lib\unijdbc.jar;C:\U2\UniDK\jdbc\lib\asjava.zip;%CLASSPATH%

Note that this is based on a default installation and should be evaluated whether this successfully points to the file on the Yellowfin server!

Windows Service -

If you have installed Yellowfin as a Windows Service and manage the startup through the Services applet, you will need to adjust the approach to set your CLASSPATH.

Browse to the <YellowfinInstall>/appserver/bin folder and open a command prompt here. You'll want to issue the following command to adjust your startup settings:

tomcatXw.exe //ES//Yellowfin

where X is the version number of Tomcat found in this folder. In my case, it was tomcat8w.exe.

This will open the Properties of your Yellowfin service. The 'Java' tab contains your CLASSPATH settings. Simply append the paths to both the unijdbc.jar and the asjava.zip files here. In example, I'll add the following to the CLASSPATH box:

C:\U2\UniDK\jdbc\lib\unijdbc.jar;C:\U2\UniDK\jdbc\lib\asjava.zip


And restart Yellowfin.

Connecting to the Data Source!

Great, now that the fun part is over we can connect!

Click to add a new Data Source and choose 'Generic JDBC Data Source'.

Under JDBC Driver choose com.rs.u2.jdbc.UniJDBCDriver(unijdbc.jar).

Your connection string should be in this format: jdbc:rs-u2://<host>:<port>/account[{?|;}name=(value) [;name=(value)]... ]

Enter the required parameters and connect!