Problem with the LargeObjectManager class in 7.2.1 java libraries?

From: "Bill Thomason" <wbt(at)modelsoftware(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Problem with the LargeObjectManager class in 7.2.1 java libraries?
Date: 2003-03-31 17:50:04
Message-ID: 003601c2f7ad$f9148670$b701a8c0@Hazelnut
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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()

Browse pgsql-jdbc by date

  From Date Subject
Next Message Patrik Lundgren 2003-03-31 21:04:23 Re: setCatalog()
Previous Message Barry Lind 2003-03-31 16:44:25 Re: setCatalog()