Jdatastore is a pure Java lightweight relational database launched by Borland. Compared with the huge Oracle and SQL Server, jdatastore is much smaller and has low requirements on the system, but its performance is not bad at all. Jdatastore's high performance includes the following features:
1. Supports JDBC and dataexpress interfaces;
2. Zero-administration embedded relational database;
3. Supports transactional multi-user access;
4. Support disaster recovery;
5. Storage of 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 SQL-92-compliant database that can be embedded directly in applications without external database engines. Generally, we access the database through the driver or dataexpress component. Jdatastore supports most JDBC data types, including Java objects.
Jdatastore serializes objects and file streams in an application into a physical file to improve convenience and mobility.
Jdatastore supports mobile offline applications. Using the dataexpress JavaBean Component, jdatastore can asynchronously copy and cache data from the data source, and reflect the cached data updates to the database.
Generally, we use jdatastore in two ways. One is that jdatastore is directly used as a server, and the other is used as an embedded database. For example, a simple desktop program can use jdatastore as an embedded database. The client Java application uses JDBC or dataexpress interfaces to access local database files. For example, in the PDA dictionary software, small recording systems, etc.
If it is a more complex system, for example, to construct a B/S structure system, we need to use entity ejbs to access data. We want to deploy the data as a data source on the EJB container, in this case, you can deploy jdatastore on a network server and use it as the application server data source.
How to configure jdatastore
Describes the corresponding configurations of jdatastore based on the two usage methods of jdatastore.
Configuration directly used as a server
Start jdatastore server(on windows, the executable file name is jdsserverw.exeor jdsserver.exe, and the graphic interface is displayed at the end of W). Open the options property page 1.
Figure 1
1. Set the port number in jdatastore server. Fill in the port text box on the options property page with the port number you want to use. In temp directory, you can specify the temporary file directory to be used by the query engine. Specify the log file directory of the jdatastore server in status log directory.
Note: These values can be modified only when the jdatastore server shut is down.
2. If you access remote data, the JDBC client should be configured as follows:
Database DRIVER: COM. Borland. datastore. JDBC. datastoredriver.
URL for database connection: JDBC: BORLAND: dsremote: // The filename is the complete path name of the machine where the database file is located. For example, the filename of my database file is: "D:/jbuilder7/samples/jdatastore/datastores/employee. JDS ".
During client access, assume that the port number is 9876, the username is myusername, and the server name is mobile. mycompany. com. The file name is C:/someapp/ECOM. 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 );
|
Configurations used as an Embedded Database
To access local data, you can configure as follows:
1. Database driver usage: COM. Borland. datastore. JDBC. datastoredriver;
2. Connect to the Database URL: JDBC: BORLAND: dslocal: ;
3. filename is the path of the local file. Note that the file path delimiter can only be "/", not "/".
Use jdatastore explorer to manage databases
Jdatastore databases are managed using the jdatastore explorer provided by jdatastore. The main functions of jdatastore Explorer are as follows:
1. Check the content of jdatastore;
2. You can perform most database operations on jdata store without writing code. For example, you can create a new table, convert a text file into a dataset, load the file as a file stream, and delete tables, files, and datasets;
3. Manage queries;
4. Manage the security of jdatastore, such as username, password, and encryption.
Basic operations of jdatastore
Jdatastore startup
There are three ways to start jdatastore:
1. Run the menu command from the tool bar of JBuilder | jdatastore explorer;
2. Run the menu command from the jdatastore server toolbar file | jdatastore explorer;
3. Start from the command line.
Page 2 after jdatastore explorer is started.
Figure 2
Create a jdatastore File
Most jdatastore operations require a jdatastore file. To create a new file, follow these steps:
1. Select File | new or click New jdatastore. At this time, a pair will be opened, and a dialog box 3 will be opened;
2. Enter the appropriate file name;
3. Select the version of the jdatastore file. The default value is jds5.0;
4. Select the size of the file block;
5. Select txmanager correctly;
6. If it is a non-transactional jdatastore, you do not need to select txmanager install. If it is a transactional jdatastore, You must select install. In this case, you can click Properties to set properties.
Click OK. The file is created and opened by jdatastore explorer.
Open the jdatastore File
1. Select File | new. A standard Java file dialog box is displayed;
2. Select the file to open and click OK;
3. To open a file in read-only mode, select View | options. A dialog box is displayed, 4.
Figure 4
4. Select "Open jdatastore in read-only mode.
Create a new table
1. Select File | open to open the database file for creating a new table;
2. Select Tools | create table menu command. Dialog Box 5 is displayed;
Figure 5
3. Enter the table name in the Table Name text box;
4. If you want to internationalize a table, you can specify a regional character set (Table locale) for the table. Otherwise, you can set this value to null;
5. click in the navigation bar to add a row of records;
6. click in the corresponding area of column name and enter the column name;
7. Specify the data type for each column. You can select or directly enter the data type. Each column must contain at least one column name and one data type. You can also specify other attributes for a column;
8. Create a new column as required;
9. Click "OK" to create the table.
Create an index
1. Select File | open to open the database file for which you want to create an index;
2. Click the tools | create index menu command. The create index Dialog Box 6 is displayed;
Figure 6
3. In the table name drop-down box, select the column name of the index to be added;
4. Specify the regional character set (locale) of the table, which provides the character set for jdatastore sorting. If the region character set is not specified during table creation, leave it blank;
5. Select "unique", that is, only different rows of data can be selected;
6. Select "case sensitive", which is case sensitive;
7. Select "sort as inserted", that is, sort by insert order;
8. Select ascending or descending from "selected column sort order;
9. Click "OK" to complete index creation.
Jdatastore Security Management
Manage Users
To manage users, select Tools | administer users. If no administrator has been created before, a dialog box will pop up when you select this command to enter the user name and password. The password you enter will be automatically used as the administrator user and has the power to use it.
If you log on as an administrator, a dialog box 7 is displayed. The administrator user dialog box allows you to add, delete, and edit user permissions.
Figure 7
Change Password
To change the password, you must first log on. 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 encrypts the file immediately. The program will pop up a message box indicating that the encryption is successful or fails. If the encryption is successful, the system automatically creates a backup of the original file.
Jdatastore example
The example in this article describes how to use JDBC to operate jdatastore deployed on the server, which is passed under jbuilder7.0. To run this example, you need to create a jdatastore file with TX Manager installed. Download and view the specific code.
Jdatastore release
Jdatastore can be released either by using jdatastore server or by using an embedded database.
Including jdatastoreThe server that the server publishes must publish three files: jdsserver. jar, JDS. jar, and DX. jar. If you want to publish data in Gui mode, you also need dbswing. jar and dbtools. Jar files. The client needs to publish three files: jdsremote. jar, JDS. jar, and DX. Jar. For Embedded databases, you only need JDS. jar, jdsremote. jar, and DX. jar.
Conclusion
This is where jdatastore is written. I believe that after reading this article, you can use jdatastore for database development. If you want to study the content in depth, you can go to the Borland news group to discuss it, or refer to the articles on the company's website.