At 11:07 15/09/2003 -0300, you wrote:
Be Happy !! You just have half of the work, hehehe ;)
Alessandro
----- Original Message -----=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
From: Robert Gomez-Reino
To: [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 10:56 AM
Subject: Re: [JAVA3D] Loading shapes from databases
The problem is that I am not going to store the geometries in databases, the idea is that I will load the geometry (of a big machine) that will be manually stored in databases by another group. Looks like a big task, maybe somebody else has done something similar already.
----- Original Message -----=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
From: Alessandro Borges
To: [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 3:56 PM
Subject: Re: [JAVA3D] Loading shapes from databases
I see no problems to store geometries in a DB.
Geometries are usualy big files, so varchar2 my not fit your needs. DB LONG, CLOB and BLOB my help here.
about what kind of info will be stored:
The database format LONG is used to store large strings, but you can store binary data as explained below;
There also CLOB and BLOB DB formats but I never use it, maybe a skilled DBA can help you.
Using DB LONG fields to store binary data
================================
(You can use the below routine to store data in ASCII format too. Just use String.getBytes() to get the byte[] . )
* put your binary data in array of bytes
* of course you will implement the toByteArray() method ;-)
byte[] mydata = myGeometry.toByteArray()
* create a String from that byte array
String strGeomData = new String(mydata);
* finnaly store you String as used in a DB LONG colum, by using the setAsciiStream, something like this:
PreparedStatement pstmtDst =
connDst.prepareStatement (" insert into GEOM (id_geom,geom_data)" +
" values (?, ?)");
StringBufferInputStream is = new StringBufferInputStream(strGeomData);
pstmtDst.setAsciiStream (2, is, strGeomData.length());
pstmtDst.setInt (1, geometryID);
pstmtDst.executeUpdate();
* to read your data, you can do more or less something like this:
PreparedStatement pstmtSrc =
connSrct.prepareStatement (" Select id_geom, geom_data from GEOM " +
" where id_geom = (?)");
pstmtSrc.setInt(1, geometryID);
ResultSet rset = pstmtSrc.executeQuery();
String strGeomData = null;
while (rset.next()) // expecting more than 1 result handle it here by using Vector, hashtable etc
{
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(rset.getAsciiStream(2)));
strGeomData = new String(bufferedreader.readLine());
}
byte[] myBinaryGeom = strGeomData.getBytes();
// use your binary data as you wish ;-)
===============
TIP ::
You can compress/decompress your binary data by using java.util.zip.Inflater/java.util.zip.Deflater classes, respec.
We use it, and the results are very impressive.
The above code is not 100% bug free. So code it with care.
Alessandro Borges
"In principle, everything is a byte array ..."
----- Original Message -----=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
From: Robert Gomez-Reino
To: [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 7:17 AM
Subject: [JAVA3D] Loading shapes from databases
Hi people,
is anybody working with this? Loading geometries from databases? Can you give me any information about this? Recommendations?
Boby
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
Silvere Martin-Michiellot builds the Internet future on www.digitalbiosphere.com
__________________________________________________________________________________________
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".