portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pernoud Aurelien" <apern...@sopragroup.com>
Subject RE: PSML stored in BLOB column in Oracle database
Date Wed, 29 Oct 2003 17:05:55 GMT

Jetspeed shouldn't update profile to null, are you sure your jetspeed_user_profile was correctly
migrated to BLOB type ?

Here is a utility I wrote to get the profile from DB and extract it back to XML, see if it's
ok :

import java.io.File;
import java.io.FileOutputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class BlobExtract
{
	public static void main(String[] args)
	throws Exception
	{
	 try
	 {  
		 System.setProperty("jdbc.drivers","oracle.jdbc.driver.OracleDriver"); 
	 	 // Prepare a connection
	 	 Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@host:port:tns", "username",
"password");

	 	
	 	 // Prepare a Statement:
		 PreparedStatement stmnt = conn.prepareStatement("select PROFILE from JETSPEED_USER_PROFILE
where USER_NAME='USERNAM'");
		 

		 // Execute
		 ResultSet rs = stmnt.executeQuery();
		 
		// On en fait un fichier
		FileOutputStream out = new FileOutputStream(new File("C:\\Temp\\Blob.xml"));

		 while(rs.next())
		 {
			try
			{
			   // Get as a BLOB
			   Blob aBlob = rs.getBlob(1);
			   System.out.println("Blob length : " + aBlob.length());
			   byte[] allBytesInBlob = aBlob.getBytes(1, (int) aBlob.length());
			   out.write(allBytesInBlob);
			}
			catch(Exception ex)
			{
			   // The driver could not handle this as a BLOB...
			   // Fallback to default (and slower) byte[] handling
			   //byte[] bytes = rs.getBytes(1);
			   ex.printStackTrace();
			}
		 }
	   // Close resources
	   rs.close();
	   stmnt.close();

	 }
	 catch(Exception ex)
	 {
	   ex.printStackTrace();
	 }
	}
}


Hoffman, Randy a écrit :

> I've got the latest village jar and converted the table and data to
> BLOB's but it appears jetspeed is updating the profile object (psml
> data) to null which throws a null exception in village's Value.java. 
> From my understanding, blob's are supposed to have an empty_blob
> value when empty not null.  Anyone run into this or have any ideas?
> 
> Thanks!
> 
> randy

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message