Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DataStoreConnection.copyStreams() (JDataStore Exploerer Pack Function)

12 views
Skip to first unread message

Mehmet F. Erten

unread,
Apr 4, 2006, 12:29:34 PM4/4/06
to
Windows 2000 Advance Server JDataStore could not handle _temp.jds so I
changed my code to keep the temp file size at minimum.

I saw _log_0000000000 is increasing and not going away until I do a "PACK"
within JDataStore Explorer.
I let it go a few days to see if it will be refreshed by the system or it
will crash.
It did crashed by stopping the server and stopped again after I started
again until I did a pack through JDataStore Explorer.
Most likely I will try a Linux box to see these problems will go away.
But meanwhile I like to find out if there is any code example to emulate
(programmatically) PACK feature of JDataStore Explorer with
DataStoreConnection.copyStreams()

to eliminate the temp file I stop (copy the files) start the server again.
After stop I like to do a PACK so the log file will shrink.

"c:\\jdatastore7\\bin\\jdsserverw.exe -shutdown");
== copy the jds files after the temp files are closed
-- here I like to do a PACK....
"c:\\jdatastore7\\bin\\jdsserverw.exe ");

With google search I could not find a code example for
DataStoreConnection.copyStreams(), yet.

Thanks for any help.

Quinn Wildman

unread,
Apr 4, 2006, 5:25:03 PM4/4/06
to
Here is what help has:

The following code fragment shows the basic steps for copying all the
streams to a new DataStore: // dataStore is the source, which has
already been opened
DataStore newStore;

// First create a copy with the same basic structure
newStore = new DataStore();
newStore.setFileName( "COPY_" + dataStore.getFileName() );
newStore.setBlockSize( dataStore.getBlockSize() );
newStore.create();

// Copy all streams, ignoring errors
dataStore.copyStreams(
"", // From root directory
"*", // All streams
newStore, // To new store
"", // To root directory
DataStore.COPY_IGNORE_ERRORS, // Ignore individual errors
System.out ); // Status messages to console

// Be sure to close new DataStore
newStore.shutdown();

Mehmet F. Erten

unread,
Apr 6, 2006, 3:29:31 PM4/6/06
to

Hi Quinn,
I use DataModule and Database to get connected with my jds file.

I am trying to get DataStore out of this connection.
To "pack" (copy) the DataStore I need to get the current (open) jds source
as DataStore (from your previous e-mail)

My question is how to find out the current DataStore from
DataModule/Database connection.
Thanks for your help.

Database database1 = new Database();

database1.setConnection(new
com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:borland:dsremote://###.###.#.###//c:\\jdsfilename.jds",
"user", "password", false, "com.borland.datastore.jdbc.DataStoreDriver"));

Mehmet F. Erten

unread,
Apr 6, 2006, 3:43:14 PM4/6/06
to
Looks like the following code from the JdataStore help section will do the
job.

// Dup.java
package dsbasic;

import com.borland.datastore.*;

public class Dup {

public static void copy( String sourceFile, String destFile ) {
DataStoreConnection store1 = new DataStoreConnection();
DataStore store2 = new DataStore();

try {
store1.setFileName( sourceFile );
store2.setFileName( destFile );
if ( !new java.io.File( store2.getFileName() ).exists() ) {
store2.create();
} else {
store2.open();
}
store1.open();

store1.copyStreams( "", // From root directory
"*", // Every stream
store2,


"", // To root directory
DataStore.COPY_IGNORE_ERRORS,

System.out );
} catch ( com.borland.dx.dataset.DataSetException dse ) {
dse.printStackTrace();
} finally {
try {
store1.close();
store2.close();
} catch ( com.borland.dx.dataset.DataSetException dse ) {
dse.printStackTrace();
}
}
}

Mehmet F. Erten

unread,
Apr 6, 2006, 5:48:06 PM4/6/06
to
After adding copyUsers, I can copy and open the copied database.
But Tx information is missing and also copyStreams() only copies the jds
file.
The temp file is gettting created when it starts but LOG file is not copied
with copyUSers and
not created when it starts.

try
{
store1 = new DataStoreConnection(); // or new DataStore() no
difference
store1.setUserName("admin_name");
store1.setPassword("admin_password");
store1.setFileName("c:\\jdsfile.jds");
store1.open();
store2 = new DataStore();
store2.setFileName("c:\\mbl\\copy_jdsfilename.jds");
store2.setBlockSize(store1.getBlockSize());


if ( !new java.io.File( store2.getFileName() ).exists() )
{
store2.create();
}
else
{
store2.open();
}

store1.copyUsers(store2, "admin_password", false, false); //
documentation has only 3 parameters


store1.copyStreams( "", // From root directory
"*", // Every stream
store2,
"", // To root directory
DataStore.COPY_IGNORE_ERRORS,
System.out );
}
catch ( com.borland.dx.dataset.DataSetException dse )
{
dse.printStackTrace();
}
finally
{
try
{
store1.close();
store2.close();
}
catch ( com.borland.dx.dataset.DataSetException dse )
{
dse.printStackTrace();
}

} /*


0 new messages