Problem with the LargeObjectManager class in 7.2.1 java libraries? - Mailing list pgsql-jdbc

From Bill Thomason
Subject Problem with the LargeObjectManager class in 7.2.1 java libraries?
Date
Msg-id 003601c2f7ad$f9148670$b701a8c0@Hazelnut
Whole thread Raw
List pgsql-jdbc

I’m trying to compile and build some java source code on a Windows XP Professional system.

 

The IDE I am using is NetBeans 3.4.1 and j2se 1.4.1_02 from Sun.  I have the pg72jdbc2.jar file in my class path for my IDE.

The source file compiles without any complaints but when I try to run it I get :

 

java.lang.NoClassDefFoundError: org/postgresql/largeobject/LargeObjectManager Exception in thread "main" ’

 

I am only including a pertinent code segment since the source file is rather lengthy.

 

Any ideas?  I was thinking that since I do not get any complaints until runtime that I might not have path variable  set properly.

 

Thanks,

-Bill Thomason

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

The top:

 

import java.io.*;

import java.util.*;

import java.sql.*;

import org.postgresql.largeobject.*;

import javax.jms.*;

 

.

.

.

    public void insertImage(ImageMsgObj imageObj) throws SQLException {

        if (this.c == null) {

            throw new SQLException("Connection is null in insertImage method.");

        } else {

            try {

                // All LargeObject API calls must be within a transaction

                // set auto commit to false

                c.setAutoCommit(false);

               

                // Get the Large Object Manager to perform operations with

                LargeObjectManager lobj = ((org.postgresql.Connection) c ).getLargeObjectAPI();

               

                //create a new large object

                int oid = lobj.create(LargeObjectManager.READ | LargeObjectManager.WRITE);

                

                //open the large object for write

                LargeObject obj = lobj.open(oid, LargeObjectManager.WRITE);

               

                // copy ImageData to the LargeObject

                obj.write(imageObj.getImage(),0,imageObj.getImage().length);

                obj.close();

                PreparedStatement ps = c.prepareStatement("INSERT INTO image VALUES (?, ?, ?, ?,?,?)");

                ps.setInt(1, imageObj.getCameraNumber());

                ps.setInt(2, imageObj.getVideoServerID());

                ps.setLong(3, imageObj.getTimestamp());

                ps.setInt(4, oid);

                ps.setInt(5, imageObj.getExposure());

                ps.setInt(6, imageObj.getGain());

                ps.executeUpdate();

                c.commit();

                ps.close();

                c.setAutoCommit(true);

            } catch(SQLException ex) {

                System.err.println("*SQLException: " + ex.getMessage());

                if (c != null){

                    try {

                        System.err.println("Transaction is being rolled back");

                        c.rollback();

                    } catch (SQLException excep) {

                        System.err.println("**SQLException: " + excep.getMessage());

                    } // end of catch excep

                } // end if c != null

            } // end of catch ex

        } // end of else

    } // end of insertImage()

pgsql-jdbc by date:

Previous
From: Barry Lind
Date:
Subject: Re: setCatalog()
Next
From: "Patrik Lundgren"
Date:
Subject: Re: setCatalog()