JDATASTORE is a pure Java lightweight relational database introduced by Borland. Compared with the huge Oracle, SQL Server, JDATASTORE is much smaller, and the requirements for the system are low, but its performance is not bad. The high performance of JDATASTORE includes the following features: 1. Support JDBC and DataExpress interface; 2. Zero-Administration) embedded relational database; 3. Support transaction multi-user access; 4. Support disaster recovery;
5. Can store serialized objects, tables, and other file streams; 6. Provides some Java Bean components that can be operated by visual development tools.
When to use JDATASTORE
JDATASTORE is a database that complies with SQL-92, which can be embedded directly in the application without an external database engine. Typically, we use the drive or DataExpress component to access the database. JDATASTORE supports most JDBC data types, including Java objects. JDATASTORE enables behavior of objects and file streams in the app to improve convenience and mobility. JDATASTORE supports mobile offline applications. With the DataExpress JavaBean component, JDATASTORE can copy and cache data asynchronously from the data source and reflect the data updates in the cache to the database. Typically, we use two ways to use JDATASTORE, one is to use JDATASTORE as a server, and the other is used as an embedded database. For example, a simple desktop program can be used as a embedded database with JDATASTORE. Client Java Application uses JDBC or DataExpress interface to access local database files. Such as dictionary software, small recording system, etc. in PDA. If it is a more complex system, such as a system to construct a B / S structure, use entity EJB to access data, we want to deploy data as a data source on the EJB container, you can deploy JDATASTORE On a server in a network, use as the application server data source.
How to configure JDATASTORE
The corresponding configuration of JDATASTORE is described in two ways of JDATASTORE. Directly as a server used to start JDATASTORE Server (Windows usually executable file named JDSSERVERW.EXE or JDSSERVER.EXE, with a graphical interface with a graphic interface), open the Options property page, as shown in Figure 1.
figure 1
1. Set the port number in JDATASTORE Server. Fill in the port number you want to use in the port text box in the Options property page. In Temp Directory, you can specify the temporary file directory to use by the query engine. Specify the log file directory of the JDATASTORE Server in Status Log Directory. Note: These have to be modified in the state of JDATASTORE Server Shut Down. 2. If you are accessing remote data, the JDBC client should be configured as follows: Database Driver: com.borland. Datastore.jdbc.DataStoreDriver. Connect the URL of the database:
JDBC: Borland: dsremote: //
The filename is a complete path name of the database, for example, the filename of my database file is: "D: /jbuilder7/samples/employee.jds". When the client access, the port number assumed is 9876, the user name is myUsername, the server is named mobile.mycompany.com, the file is fully named c: /someApp/ECOM.JDS, the database connection code is as follows. Class.Forname ("com.borland. Datastore.jdbc.datastoredriver);
Java.util.properties info = new java.util.properties ();
Info.SetProperty ("User", "MyuserName");
Info.SetProperty ("Port", "9876");
Connection Con = DriverManager .getConnection
("JDBC: Borland: dsremote: //mobile.mycompany.com/c: /someapp/ECom.jds", Info;
As the configuration used by the embedded database If you are accessing local data, you can configure it as follows: 1. Database driver use: com.borland .datastore.jdbc.datastoredRiver; 2. Connect the database URL: JDBC: Borland: Dslocal:
;
3. FileName is the path to the local file, note that the file path spaster can only be "/" instead of "/".
Use the JDATASTORE Explorer management database
The JDATASTORE database is managed with JDATASTORE Explorer provided. The main functions of JDATASTORE EXPLORER are as follows: 1. Check the content of JDATASTORE; 2. You can perform most of the database operation of the JDATA Store without writing code. For example, create a new table, transform the text file into a data set, load files, delete tables, files, datasets, etc. And encryption. JDATASTORE's basic operation of JDATASTORE has three ways to start JDATASTORE: 1. From JBuilder's toolbar Tools | JDATASTORE Explorer executive menu commands; 2. From the JDATASTORE SERVER toolbar File | JDATASTORE Explorer executes menu commands; 3. Start from the command line. The interface after the JDATASTORE Explorer is launched as shown in Figure 2.
figure 2
Creating a JDATASTORE operation in a JDATASTORE file requires a JDATASTORE file. The steps to create a new file are as follows: 1. Select File | New or click the New JDATASTORE button. At this time, it will open a dialog box as shown in Figure 3;
2. Enter the appropriate file name; 3. Select the version of the JDATASTORE file, default is JDS5.0; 4. Select the size of the file block; 5. Correctly select TxManager; 6. If it is a non-transaction (No Transact Ional) There is no need to choose TXManager Install; if it is a transactional JDATASTORE, you must select Install. At this point, you can set the properties by clicking Properties. Click OK, this file is created, and is opened by JDATASTORE Explorer. Open a JDATASTORE file 1. Select the File | New menu, then a standard Java file dialog is open; 2. Select the file you want to open Click OK; 3. Want to open the file in read-only mode, you can choose View | Options, this A dialog box will pop up, as shown in Figure 4. Figure 4
4. Select "Open JDATASTORE IN Read-Only Mode" is OK. Create a new table 1. Select File | Open to open the database file you want to create; 2. Select the Tools | CREATE TABLE menu command, pop-up dialog box as shown in Figure 5;
Figure 5
3. Enter a table name in the Table Name text box; 4. If you want to internationalize the table, you can specify a Table Locale for the table, otherwise you can make this value null; 5. On the navigation bar, Increase a line of records; 6. Click in the area corresponding to the Column Name, enter the column name; 7. Specify the data type for each column, you can select or direct input. Each column must at least specify a column name and a data type. You can also specify other properties for columns; 8. Continue to create new columns; 9. Click "OK" to complete the creation of the table. Create an index 1. Select File | Open to open the database file you want to create; 2. Click the Tools | Create INDEX menu command to open Create Index dialog box as shown in Figure 6;
Figure 6
3. Select the column name you want to add index in the Table Name drop-down box; 4. Specify the regional character set (LOCALE) of the table, which will provide a character set for JDATASTORE. If you do not specify a regional character set when you create a table, let it empty; 5. Select "Unique", just select different lines of data; 6. Select "Case Sensitive", which is sensitive to case, 7. Select "Sort as inserted" is sorted in insertion sequence; 8. Select ascending or descending order from "Selected Column Sort ORDER"; 9. Click "OK" to complete the index. JDATASTORE security management Manage Users want to manage users first, first select the Tools | Administer userS command. If you haven't created an administrator before, you will pop up a dialog box when you select this command, allow your input username and password, and your entered password will automatically use the power used by administrator users. If you log in with an administrator, a dialog box as shown in Figure 7 will pop up. You can add users, delete users, and edit user permissions.
Figure 7
Modifying password users To change the password, you must first log in. Then select the Tools | Change Password command to change the password. Database encryption To encrypt a JDATASTORE file, select Tools | Encrypt JDataStore command. JDATASTORE Explorer will immediately encrypt files. The program will pop up a message box indicating successful or failed to encrypt. If the encryption is successful, the system automatically creates a backup of the original file. JDATASTORE example
The examples of this article describe how to use JDBC to operate JDATASTORE on the server and pass in JBuilder7.0. To run this example, you need to create a JDATASTORE file installed with TX Manager, and the specific code download browsing.
JDATASTORE
There are two ways to publish JDATASTORE: one is a release of JDATASTORE Server, one is used as an embedded database. The Server terminal containing JDATASTORE Server needs to post a jdsserver.jar, jds.jar, and dx.jar three files. If you need to release in a GUI mode, you also need two files for dbswing.jar and dbtools.jar. The client needs to publish three files for jdsremote.jar, jds.jar, and dx.jar; use as an embedded database, just JDS.jar, JDSRemote.jar and Dx.jar.
Conclude
Write this about JDATASTORE. I believe that after reading this article, you can already use JDATASTORE to develop databases. If you want to study the content in depth, you can discuss Borland's newsgroups or see the article on the company's website.