Thread View: borland.public.jdatastore
5 messages
5 total messages
Started by Mehmet F. Erten
Tue, 04 Apr 2006 16:29
DataStoreConnection.copyStreams() (JDataStore Exploerer Pack Function)
Author: Mehmet F. Erten
Date: Tue, 04 Apr 2006 16:29
Date: Tue, 04 Apr 2006 16:29
26 lines
2135 bytes
2135 bytes
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.
Re: DataStoreConnection.copyStreams() (JDataStore Exploerer Pack Function)
Author: Quinn Wildman
Date: Tue, 04 Apr 2006 21:25
Date: Tue, 04 Apr 2006 21:25
36 lines
2155 bytes
2155 bytes
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 wrote:
>
> With google search I could not find a code example for
> DataStoreConnection.copyStreams(), yet.
>
> Thanks for any help.
>
>
>
DataModule/ DataBase vs DataStore
Author: Mehmet F. Erten
Date: Thu, 06 Apr 2006 19:29
Date: Thu, 06 Apr 2006 19:29
17 lines
1678 bytes
1678 bytes
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"));
DataStoreConnection store1 with DataStore store2
Author: Mehmet F. Erten
Date: Thu, 06 Apr 2006 19:43
Date: Thu, 06 Apr 2006 19:43
41 lines
2380 bytes
2380 bytes
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();
}
}
}
copyStreams needs copyUsers, and still more.
Author: Mehmet F. Erten
Date: Thu, 06 Apr 2006 21:48
Date: Thu, 06 Apr 2006 21:48
51 lines
2755 bytes
2755 bytes
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();
}
} /*
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads