Save file on server side from database (WebClient)

Forum to discuss the Web client version of Servoy.

Save file on server side from database (WebClient)

Postby Roberto Blasco » Tue Nov 26, 2013 2:07 pm

Hi all.

I'm developing a Web Client solution with some pictures saved on the database as blob fields (server side). How can I store those files on the same server without creating a local side temp file and stream it again to the server?

Thanks in advance !!
Best Regards. Roberto Blasco.
Un saludo. Roberto.

Madrid - Spain
Tfno: (+34) 625653066
E-mail: roberto.blasco.serrano@gmail.com
User avatar
Roberto Blasco
007
 
Posts: 355
Joined: Tue Apr 08, 2008 7:18 pm
Location: Madrid / Spain

Re: Save file on server side from database (WebClient)

Postby mboegem » Tue Nov 26, 2013 7:09 pm

You can run a client on the server and process your table.
Client can be smart- as well as headless, this depends on whether this is a 1 time job or should be done continuously.
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1748
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Save file on server side from database (WebClient)

Postby Roberto Blasco » Thu Nov 28, 2013 3:18 am

Thanks a lot mboegem, I'l' try it.

Best regards. Roberto Blasco.
Un saludo. Roberto.

Madrid - Spain
Tfno: (+34) 625653066
E-mail: roberto.blasco.serrano@gmail.com
User avatar
Roberto Blasco
007
 
Posts: 355
Joined: Tue Apr 08, 2008 7:18 pm
Location: Madrid / Spain

Re: Save file on server side from database (WebClient)

Postby Adelo Herrero » Fri Nov 29, 2013 9:12 am

Hello:

Roberto, you can use a stored procedure in the database, that for example, when insert or update record, save the blob field to a file system and assign null value to field, if the field isn't neccesary in the record.

If the database is Postgresql, the procedures run with "select" for this, You can also run this procedure from servoy with getDataSetByQuery(....) In another database engine ... I don't know.

Best regards.
Adelo Herrero
Adelo Herrero
 
Posts: 103
Joined: Sat Jul 25, 2009 9:24 pm
Location: Requena (Valencia) España

Re: Save file on server side from database (WebClient)

Postby Roberto Blasco » Fri Nov 29, 2013 10:49 am

Good Idea !!! Adelo :D :D

Thanks a lot

Best regards. Roberto Blasco
Un saludo. Roberto.

Madrid - Spain
Tfno: (+34) 625653066
E-mail: roberto.blasco.serrano@gmail.com
User avatar
Roberto Blasco
007
 
Posts: 355
Joined: Tue Apr 08, 2008 7:18 pm
Location: Madrid / Spain

Re: Save file on server side from database (WebClient)

Postby Jan Aleman » Fri Nov 29, 2013 2:10 pm

I still wonder: what exactly do you want to do? What is the user story here?
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Re: Save file on server side from database (WebClient)

Postby Roberto Blasco » Sat Nov 30, 2013 1:55 am

Hi Jan.

What I want to do is to store files on server side in a file system, but, without uploading then from the client side.

The story is the following one .... :D

One solution running disconnected from the server, this solution has to be able to store pictures,docs... in the database. When in my office, the local solution has to be synchronized with the one deployed in the server. One programmed schedule will store those files in the server side, will set to null the blob field and will fill the server pathname field of the file (MD5/SHA-1-) in that table.

If a work team has to go outside again with the disconnected solution and save more files in the database, those will be stored by the schedule job in an automatic way when the solution will synchronized.

Same solution ... One disconnected (without the schedule job) able of storing files in the database and the other one running in a server with the files linked through the pathname to a file system.

So, that's why I want to know how to store files in a folder in the server with a process running on server side :D

Thanks in advance, and sorry because my English ...

Best regards. Roberto Blasco
Un saludo. Roberto.

Madrid - Spain
Tfno: (+34) 625653066
E-mail: roberto.blasco.serrano@gmail.com
User avatar
Roberto Blasco
007
 
Posts: 355
Joined: Tue Apr 08, 2008 7:18 pm
Location: Madrid / Spain

Re: Save file on server side from database (WebClient)

Postby ROCLASI » Sat Nov 30, 2013 11:50 pm

Hi Roberto,

So if I understand correctly there is some offline client that may sync with the server and then the server wants to store the images that were stored in the database to the filesystem when convenient.
Yes you could use stored procedures for this but in PostgreSQL's case you need to use pl/perlU (as in Untrusted) to be able to write to the filesystem (see http://www.postgresql.org/docs/9.3/stat ... usted.html).
But I think you will still have permission problems if any other process than PostgreSQL has to access it (like Servoy Server).
So my best guess is to use a batch process in Servoy Server and write the BLOB data to files using the file plugin.

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Save file on server side from database (WebClient)

Postby Roberto Blasco » Sun Dec 01, 2013 1:04 pm

Thanks ROCLASI.

As Adelo and you say I think the best choice is the combination between Postgres Stored Procedures and a batch processor in Servoy Servet.

Thanks a lot.
Best Regards. Roberto Blasco.
Un saludo. Roberto.

Madrid - Spain
Tfno: (+34) 625653066
E-mail: roberto.blasco.serrano@gmail.com
User avatar
Roberto Blasco
007
 
Posts: 355
Joined: Tue Apr 08, 2008 7:18 pm
Location: Madrid / Spain

Re: Save file on server side from database (WebClient)

Postby ROCLASI » Mon Dec 02, 2013 10:42 pm

Hi Roberto,
Roberto Blasco wrote:As Adelo and you say I think the best choice is the combination between Postgres Stored Procedures and a batch processor in Servoy Servet


I actually didn't say it was the best choice, just that it was technically feasible.

How are the files being access after they have been written to the filesystem? Through stored procedures? That is not very efficient.
Also you say you synchronize the offline client to the database, how ? Is this Mobile Client? If so why not directly write the files to the filesystem from the headless client who handles the syncing.
If it's a regular offline client you could use the same method as well (REST).

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Save file on server side from database (WebClient)

Postby Roberto Blasco » Wed Dec 04, 2013 12:03 am

Mmmm.

I've to study this way .... XD XD

Thanks a lot.
Un saludo. Roberto.

Madrid - Spain
Tfno: (+34) 625653066
E-mail: roberto.blasco.serrano@gmail.com
User avatar
Roberto Blasco
007
 
Posts: 355
Joined: Tue Apr 08, 2008 7:18 pm
Location: Madrid / Spain


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 6 guests

cron