www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Melssj5 on July 12, 2008, 01:38:29 am

Title: Object3d got from a database
Post by: Melssj5 on July 12, 2008, 01:38:29 am
Hi, Can I make an Object3D from a database information, I mean, I want to save all the 3ds files and textures on a database as blob and reconstruct them to use them in jpct. I have no idea about this, any clues?
Title: Re: Object3d got from a database
Post by: EgonOlsen on July 12, 2008, 07:04:33 pm
You need some tool to read the files and write them into the blob and vice versa. That should be sufficient. Depending on the database, blobs can be a bit tricky (on Oracle for example). However, what's the purpose of this? Personally, i wouldn't do this. I once did that myself with graphics, but i found it too cumbersome to use. I wouldn't do it again that way but simply store a reference to the file on the hard disc in the DB instead.
Title: Re: Object3d got from a database
Post by: Melssj5 on July 12, 2008, 09:13:18 pm
The requirements of the project is that the 3d models have to be stored on a database and not as files in the server for security, but I guess I can save the file on non user visible folders on my web server. Maybe sme requirements have to be changed in order to achieve quickly the project.
Title: Re: Object3d got from a database
Post by: EgonOlsen on July 12, 2008, 11:29:20 pm
It isn't that hard to write some code that reads/writes blobs. If the project requires it, then so be it. Which database server is that?
Title: Re: Object3d got from a database
Post by: Melssj5 on July 14, 2008, 03:52:14 pm
It will be mysql 4.x.
Title: Re: Object3d got from a database
Post by: EgonOlsen on July 16, 2008, 12:09:57 am
MySQL should be fine when dealing with blobs. At least i can't remember having any issues with it regarding blobs.
Title: Re: Object3d got from a database
Post by: paulscode on July 16, 2008, 12:21:39 am
This sounds interesting.  Any chance I can see the source code when you finish this?
Title: Re: Object3d got from a database
Post by: Melssj5 on July 16, 2008, 02:19:48 am
Pray for me to finishing it becausse I am not finishing my projects this days, jaja. I will try a bit to do it but if not I will better place the file on specific folders.
Title: Re: Object3d got from a database
Post by: paulscode on July 16, 2008, 03:05:04 am
Pray for me to finishing it becausse I am not finishing my projects this days, jaja. I will try a bit to do it but if not I will better place the file on specific folders.

LOL, np
Title: Re: Object3d got from a database
Post by: Melssj5 on September 27, 2008, 02:14:53 am
well I was thinking on serializing the object3d and saving it into a file then getting the file and reading its bytes and saving the array in the database, and viceversa. But I am doing unnecesary reads and writes from the harddisc. How can I get an object converted to a byte array?

I was checking the ByteArrayStreams and the StringBufferStreams with no luck.

there should be a way in the jdbc to do an insert of an Object directly.
Title: Re: Object3d got from a database
Post by: Melssj5 on September 27, 2008, 02:41:16 am
Hi, I found this. Very interesting, at least for me.

A record can be inserted directly to the database using the Resultet and the insertRow method.

should be something like that:

        1.- getting the ResultSet rs
        2.- rs.moveToInsertRow();
   3.- rs.updateObject(int columnIndex, Object x, int scale)
        4.- calling to rs.insertRow ()

This should insert the object on the database. I will try it by tomorrow becausse I must go home before I got stabbed. If anyone have try it please post it.