db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan M. Feldstein" <a...@alanfeldstein.com>
Subject VALUES expression, BLOB, and using ij
Date Thu, 24 May 2007 01:42:49 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<body bgcolor="#ffffff" text="#000000">
Programmatically, I was able to provide the value for a BLOB column
from a binary file with the following code sequence:<br>
pstmt =
connection.prepareStatement( "INSERT INTO \"ADDTestCases\" (
\"pairID\", \"expectedSum\", \"executableFile\" ) VALUES( " +
Long.toString( pairID ) + ", " + Long.toString(
testCase.getExpectedSum() ) + ", ? )" );</tt><br>
  <tt>File file = testCase.getExecutable().getFile();</tt><br>
  <tt>FileInputStream stream = new FileInputStream( file );</tt><br>
  <tt>pstmt.setBinaryStream( 1, stream, (int)( file.length() ) );</tt><br>
Alternatively, I should be able to use ij to execute SQL statements
interactively or via a script in order to add a couple of rows to the
database. So far, I have:<br>
<blockquote><tt>INSERT INTO "ADDTestCases" ( "pairID", "expectedSum",
"executableFile" ) VALUES( 1, 0, ? );<br>
INSERT INTO "ADDTestCases" ( "pairID", "expectedSum", "executableFile"
) VALUES( 2, 1, ? );<br>
but I don't think ij is going to like the dynamic parameters.
Furthermore, I haven't thought of a way to set up the binary stream in
that environment. Is something like this going to be possible using ij?<br>
I want to put a couple of rows into the database on a clean machine
using a minimalist approach, as proof of concept for the specification
database specification I'm writing <a
I'll be just about done writing that Web page once I can explain the
requirements for populating the executableFile column.<br>
<div class="moz-signature">-- <br>
<meta name="generator"
 content="HTML Tidy for Solaris (vers 1st March 2004), see www.w3.org">
<title>Alan M. Feldstein</title>
<p>Alan Feldstein</p>
<img src="cid:part1.04060309.07040401@alanfeldstein.com"
 alt="Cosmic Horizon logo" height="55" width="101">
<p><a href="http://www.alanfeldstein.com/">http://www.alanfeldstein.com/</a></p>
<p>+1 585 415 6682</p>

View raw message