db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Rossomando" <rossoman...@verizon.net>
Subject RE: master and slave are not in synch for replicated database
Date Sat, 11 Apr 2009 01:07:05 GMT
I have long been a silent member of this group but I now need help.
The following code was written by me to insert a Blob into the DB.

	public void insertImage(BufferedImage image) {
		try {
			byte[] bytes = this.getBytes(image);
			System.out.println("Bytes given to archive: " +
bytes.length);
			String sql = "UPDATE TEST SET IMAGE = ? WHERE ID =
?";
			PreparedStatement ps = conn_.prepareStatement(sql);
			// ps.setBinaryStream(1, new
ByteArrayInputStream(bytes),
			//			bytes.length);
			ps.setBlob(1, new ByteArrayInputStream(bytes),
bytes.length);
			ps.setInt(2, 1);
			System.out.println("Rows written: " +
ps.executeUpdate());
			conn_.commit();
			ps.close();
			System.out.println("Image Stored!");
		} catch (SQLException e) {
			printSQLError(e);
		} catch (Exception exc) { // process error
			System.err.println("process error" + exc);
		}
		return;
	}

I converted a buffered image into an array bytes and then use setBlob() to
prepare
To write the blob to the db. Doing a bytes.length I get 372076. When I do my

executeUpdate() I get back 0 indicating nothing was written. Sure enough, in
IJ I
see nothing was written Why? I tried setBinaryStream() changing Blob to
LONVARBINARY.
That didn't work either? Again Why.

Please help me here. Thank you.

Phil Rossomando

-----Original Message-----
From: Brian Spindler [mailto:bspindler@netuitive.com] 
Sent: Tuesday, April 07, 2009 10:23 PM
To: Derby Discussion
Subject: RE: master and slave are not in synch for replicated database

I've tried both:

connect 'jdbc:derby:<db>;shutdown=true';

and

exit; 

both seem to simply hang and I'm forced to do Ctrl+C to get back my command
prompt.  Does that sound right? 

regardless; both result in the same error.


-----Original Message-----
From: Dag H. Wanvik [mailto:Dag.Wanvik@Sun.COM]
Sent: Tue 4/7/2009 4:57 PM
To: Derby Discussion
Subject: Re: master and slave are not in synch for replicated database
 
Brian Spindler <bspindler@netuitive.com> writes:

> Guys/Gals,
>
>  
>
> I have taken the following procedure:
>
>  
>
> 1.       Using ij logged into my database
>
> 2.       Run CALL SYSCS_UTIL.SYSCS_FREEZE_DATABASE();

I saw in another thread you use embedded. Did you do a shutdown at
this point?
E.g. connect 'jdbc:derby:<db>;shutdown=true'

>
> 3.       Exit ij
>
> 4.       Copy database to slave
>
> 5.       Start slave
>
> 6.       Start master.
>
>  
>
> Then I get this error: 
>
>  
>
> Caused by: ERROR XRE05: The log files on the master and slave are not in
> synch for replicated database 'foo'. The master log instant is 1:104173,
> whereas the slave log instant is 1:103957. This is FATAL for replication
> - replication will be stopped.
>
>                 
>
>  
>
> I thought by freezing/copying etc... they would be in synch?
>
>  
>

-- 
Dag H. Wanvik, staff engineer
Sun Microsystems, Databases (JavaDB/Derby)
Haakon VII gt. 7b, N-7485 Trondheim, Norway
Tel: x43496/+47 73842196, Fax:  +47 73842101






Mime
View raw message