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.
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();
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"));
// 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();
}
}
}
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();
}
} /*