JDBC Unable to Load JDBC driver

Boomn4x4

New Member
Hello,

I am trying to use Java to connect to the Progress DB, and am failing to do so... I have to assume there is something wrong with my path's and/or libraries. It appears that I can't even load the driver.

Here is an "ls" of my /zzz/dlc/java directory

Code:
aia.jar   java.policy   o4glrths.jar   osmetrics.jar  proxygen.zip  util.jar
base.jar  messages.jar  o4glrthsl.jar  pool.jar       schema.jar
doc       o4glrt.jar    o4glrts.jar    progress.jar   spy.jar
ext       o4glrth.jar   openedge.jar   prosp.jar      techsupp

From my understanding, I need the progress.jar, base,jar, openedge.jar, spy.jar, and util.jar packages.... all of which are there.

I have my CLASSPATH (per some documentation I've read) set to CLASSPATH=/zzz/dlc/java

My code is:
Code:
import java.net.URL;
import java.sql.*;
import java.io.*;
import java.util.Properties;

public class ProgressTest
{
    public static String dbUrl = "jdbc:datadirect:openedge://xxxxxxxxx;DatabaseName=xxx";
    public static Connection con = null;

    public static void main (String args[])
    
    {
        try 
        {

            // Load the driver
            Driver dbDriver = (Driver)Class.forName("com.progress.sql.jdbc.JdbcProgressDriver").newInstance();
            Properties props = new Properties();
            props.put("user", "xxx");
            props.put("password", "");
            con = dbDriver.connect(dbUrl, props);
        }
        catch (Exception e)
        {
            e.printStackTrace();

            System.out.println("Error: " + e.getMessage());
        }
    }
}

When I execture... I thrown an exception as follows.

Code:
mxb931@mxbscs:/fiscal> java ProgressTest
Exception in thread "main" java.lang.NoClassDefFoundError: ProgressTest
Caused by: java.lang.ClassNotFoundException: ProgressTest
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: ProgressTest.  Program will exit.

Any help would be appreciated.
 

Boomn4x4

New Member
Issue was resolved by explicting declaring my class path to point to my JAR's. For some reason, just pointing to the directory they were in, wasn't enough.
 

AdanGMC

New Member
Hello Boomn, im have the same problem. Could you explain me how exactly you solve it?

Im using a db progress 10.0B.

Thanks.
 

Boomn4x4

New Member
Hello Boomn, im have the same problem. Could you explain me how exactly you solve it?

Im using a db progress 10.0B.

Thanks.

The Progress needs the following java packages:
base,jar, openedge.jar, and util.jar

Progress looks for those packages through your OS's CLASSPATH environment variable.

First you need to locate those classes, they are probably in the "jdbc" directory of your Progress install. In my case it was /****/dlc/java. The root of my problem was that I was setting my CLASSPATH to "/****/dlc/java" however, for whatever reason, the classes needed to be explicitly declared. To fix it I set my classpath to "CLASSPATH=/***/dlc/java/base.jar:/***dlc/java/openedge.jar:/***/dlc/java/util.jar"
 
Top