Overview
The database of HubbleDotNet is just a logical concept. The purpose of this logical concept is to facilitate the management of data tables with similar attributes. HubbleDotNet does not have the database entity. In HubbleDotNet, a database can be considered as a data table management group. Data Tables in HubbleDotNet must belong to a database and inherit the public attributes of the database.
For the general concept of databases and data tables, see Hubble.net open-source full-text search database project-databases and data tables
Create a database through the interface
The QueryAnalyzer tool provided by Hubble.net allows you to easily create databases. The steps for creating a database are as follows:
Log on to the query Analyzer
Run QueryAnalyzer to enter the logon interface. Enter the address of the server to be logged on (which can be the remote host address)
Create a database
As shown in, right-click the server node and select CreateDatabase. The following page is displayed:
As shown in, in this interface, we need to specify
Database Name
Default INDEX DIRECTORY. This directory is used to store the configuration files, index files, cache, and other data of data tables in the database.
Default database Adapter. For more information about database adapters, see database adapters.
Default database connection string. This connection string is the connection string of the relational database corresponding to the hubble.net data table. During hubble.net query, the connection string is used to connect to the relational database and obtain the corresponding data. After specifying the Connection String, you can also click the Test DB Connection String button below to Test whether the Connection String can work. The connection string can be used to specify the local database or remote database.
After completing the preceding operations, click Create to Create a database. As shown in, a News Database is displayed on the page after creation.
Create a database using SQL statements
The statement for creating a database is as follows:
Exec sp_adddatabase 'new', 'd: \ test \ News \ ', 'sqlserver2005', 'Data Source = (local); Initial Catalog = news; Integrated Security = true ';
First ParameterIs the database name, which is the name of the database created in Hubble.net. The name is "News.
Second ParameterIs the default index directory of the database.
Third ParameterIs the default database adapter name. If no database adapter is specified during table creation, the default database adapter of the database where the table is located is used. This parameter is set to SQLSERVER2005. The SQLSERVER2005 database adapter supports SQLSERVER 2005 and later versions.
Fourth ParameterIs the default connection string.
Click Excute to execute the preceding statement to create a database.
Right-click the server node on the left and select Refresh. Then you can see that there is a News database added to the server node.
Delete A database from the interface
You must delete all tables in the database before deleting the database. Deleting a Database is simple. You only need to right-click the corresponding Database node and select Drop Database.
Delete using SQL
The SQL statement for deleting a database is completed through the following stored procedure:
SP_DROPDATABASE
This stored procedure requires a parameter, which specifies the database name.
Example:
EXEC SP_DROPDATABASE 'News'
Return to Hubble.net technical details