Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Create a local store.
Sun, Dec 8 2013 1:37 AMPermanent Link

Abdulaziz Al-Jasser

Hi,


CREATE STORE "DBBackup" AS LOCAL PATH  'C:\MyBackup'

In C/S environment when I create a store (using the above statement) the store is created on the remote server.  Is there a way to force it to be created locally on the user machine?


Regards,
Abdulaziz Jasser
Sun, Dec 8 2013 5:46 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Abdulaziz

>CREATE STORE "DBBackup" AS LOCAL PATH 'C:\MyBackup'
>
>In C/S environment when I create a store (using the above statement) the store is created on the remote server. Is there a way to force it to be created locally on the user machine?

If you could then you're rather defeating the purpose of a client/server environment. Anything the server does is going to relate to itself so the only way I can think of is to use UNC paths.

From your naming convention (MyBackup) I'd guess you're wanting to keep a backup on the users local machine. If I'm right why not simply set up a local session on the users machine (ElevateDB will handle c/s & f/s sessions simultaneously) and then paths relate to the local machine.

Roy Lambert [Team Elevate]
Sun, Dec 8 2013 8:50 AMPermanent Link

Abdulaziz Al-Jasser

Roy

<<From your naming convention (MyBackup) I'd guess you're wanting to keep a backup on the users local machine. If I'm right why not simply set up a local session on the users machine (ElevateDB will handle c/s & f/s sessions simultaneously) and then paths relate to the local machine.>>

Thanks for your reply.  But actually I am not doing a backup.  I am just exporting some data from one table on the remote server to a text file in the store using "EXPORT TABLE" clause.  But the store and the text file are created on the remote server.


Regards,
Abdulaziz Jasser
Sun, Dec 8 2013 10:28 AMPermanent Link

Raul

Team Elevate Team Elevate

On 12/8/2013 8:50 AM, Abdulaziz Jasser wrote:
> Thanks for your reply.  But actually I am not doing a backup.  I am just exporting some data from one table on the remote server to a text file in the store using "EXPORT TABLE" clause.  But the store and the text file are created on the remote server.

Few option i can suggest :
- create a local store as Roy indicated, do export on server and then
copy the file from remote to local store
- open the remote table in your code and navigate thru it exporting it
yourself (export to CSV type file is simple to write)

Raul
Sun, Dec 8 2013 10:52 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Abdulaziz

>Thanks for your reply. But actually I am not doing a backup. I am just exporting some data from one table on the remote server to a text file in the store using "EXPORT TABLE" clause. But the store and the text file are created on the remote server.

Raul's suggestion is a good one, and may be suitable. It depends on how big and what you're doing with the text file when you've got it.

Roy Lambert [Team Elevate]
Sun, Dec 8 2013 12:28 PMPermanent Link

Raul

Team Elevate Team Elevate

On 12/8/2013 10:28 AM, Raul wrote:
> Few option i can suggest :

One more i had forgotten - session has a function to load the file in
the store into a stream. So as long as the file is manageable size you
can just :
1. export file to store (so it's on the server)
2. use the SaveStoreFileToStream method
(http://www.elevatesoft.com/manual?action=viewmethod&id=edb2&product=rsdelphiwin32uni&version=XE2&comp=TEDBSession&method=SaveStoreFileToStream)
3. Just write the stream to local file

If the file is fairly large the local store option is likely better - i
recall Tim saying the store file copy function is a lot smarter and does
the copy in chunks (vs the SaveStoreFileToStream that has to load the
whole thing at once).

Raul
Mon, Dec 9 2013 4:48 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Raul,

<< If the file is fairly large the local store option is likely better - i
recall Tim saying the store file copy function is a lot smarter and does the
copy in chunks (vs the SaveStoreFileToStream that has to load the whole
thing at once). >>

You may be thinking of the LoadFromStream/SaveToStream methods for
tables/query result sets.  The SaveStoreFileToStream/SaveStreamToStoreFile
methods both work with 64k block sizes, so that's the most ever transferred
over the wire in a single chunk and, subsequently, written to the target
file at one time.

Tim Young
Elevate Software
www.elevatesoft.com




Mon, Dec 30 2013 11:23 AMPermanent Link

Abdulaziz Al-Jasser

Thanks all for your replies and I apologize for the late reply (I was out of town for urgent issue).  What I did is:

1- Save the file in the remote store to a TMemoryStream using "SaveStoreFileToStream" method of TEDBSession  (OK).
2- Save the stream to a local hard drive using "SaveToFile" mehtod of TMemoryStream (OK).
3- Load the stream back to a TMemoryStream using "LoadFromFile" method of TMemoryStream (OK).
4- Use "LoadFromStream" method of TEDBTable to load the data from the TMemoryStream (ERROR).

In the fourth step I got an error saying "The stream data is truncated or invalid"!  Is TMemoryStream compatible with TEDBTable streams?  Any help?


Note:  The data is only 10k.


Regards,
Abdulaziz Jasser
Fri, Jan 3 2014 11:22 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Abdulaziz,

<< Thanks all for your replies and I apologize for the late reply (I was out
of town for urgent issue).  What I did is:

1- Save the file in the remote store to a TMemoryStream using
"SaveStoreFileToStream" method of TEDBSession  (OK).
2- Save the stream to a local hard drive using "SaveToFile" mehtod of
TMemoryStream (OK).
3- Load the stream back to a TMemoryStream using "LoadFromFile" method of
TMemoryStream (OK).
4- Use "LoadFromStream" method of TEDBTable to load the data from the
TMemoryStream (ERROR).

In the fourth step I got an error saying "The stream data is truncated or
invalid"!  Is TMemoryStream compatible with TEDBTable streams? >>

Provided that the stream came from a table using the same character set
(ANSI vs. Unicode), then yes, it is compatible.  Did you check the stream
sizes on disk/in memory to make sure that they were all equal to the size of
the source stream ?

Tim Young
Elevate Software
www.elevatesoft.com
Image