DBeaver connection (DM) Dameng database
Article directory
DBeaver is a powerful database management tool that can connect to many types of databases. The following are the steps to connect to the Dameng database:
- Open DBeaver and click the "Connect" button.
- In the displayed "Connection" dialog box, select the "JDBC" tab.
- Enter the host name or IP address of Dameng database in the "JDBC host name" field.
- Enter the port number of Dameng database in the "JDBC port" field.
- Enter the user name of Dameng database in the "Username" field.
- Enter the password of Dameng database in the "Password" field.
- In the "JDBC driver" field, select the driver of Dameng database.
- Click the "Test Connection" button to test whether the connection was successful.
- If the connection is successful, click the "Save" button to save the connection settings.
- Click the "OK" button to close the "Connect" dialog box and connect to the Dameng database.
Please note that you need to download and install the JDBC driver of Dameng database first, and add it to the class path of DBeaver, so that DBeaver can recognize it.
1. Download the driver
The driver is downloaded here, you can find out. There are also drivers in my resources, just download them directly and put them in a directory.
DmJdbcDriver18.jar official website download
2. DBeaver creates a new driver
2.1 Database-Driver Manager
2.2 Create a new driver
2.3 Create driver-settings: class name, template, and port can be filled in as shown in the figure below
dm.jdbc.driver.DmDriver
jdbc:dm://{host}:{port}
2.4 Create a driver-library (add the previously downloaded jdbc driver)
2.5 Create driver-library setting driver class
2.6 Click [OK] - [Close]
3. Connect to DM database
Find the DM8 just named under Other as shown in the figure below
If copying and pasting the username and password fails to log in, try manually entering the username and password without spaces before and after
4. JDBC interface
JDBC (Java Database Connectivity) is an interface specification between Java applications and databases, designed to allow database developers to provide Java programmers with a standard database application programming interface (API). JDBC defines a cross-database, cross-platform common SQL database API.
DM JDBC database driver is a general-purpose application programming interface that can support basic SQL functions, and supports general SQL database access. Through the JDBC driver, users can realize the connection and access to the DM database in the application program. The main functions of the JDBC driver include:
- Establish a connection to the DM database.
- Transfer sends SQL statements to the database.
- Process and return statement execution results.
Since the DM JDBC driver is designed and developed in accordance with the JDBC standard specification, the functions provided by the DM ODBC interface are consistent with the standard JDBC. There are many JDBC interface functions, the following table only lists the main interfaces and functions of DM JDBC:
main class or interface | class or interface specification | main function | function description |
---|---|---|---|
java.sql.DriverManager | Used to manage drivers and establish connections with databases. The methods in its class are all static methods. | getConnection | create connection |
setLoginTimerout | Set login timeout | ||
registerDriver | register driver | ||
deregisterDriver | Uninstall the driver | ||
java.sql.Connection | The database connection class is used to manage and execute database connections, and can be used to commit and rollback transactions, create Statement objects, and other operations. | createStatement | Create a Statement object |
setAutoCommit | Set up autocommit | ||
close | close database connection | ||
commit | commit transaction | ||
rollback | rollback transaction | ||
java.sql.Statement | Used to run SQL statements on a connection and access the results. | execute | run sql statement |
executeQuery | Execute a SQL statement that returns a ResultSet | ||
executeUpdate | Execute INSERT, UPDATE, DELETE, or an SQL statement that does not return a dataset | ||
getResultSet | Used to get the result of the current ResultSet | ||
java.sql.ResultSet | Result set object, mainly used for query result access | absolute | Move the record pointer of the result set to the specified row |
next | Position the record pointer of the result set to the next row | ||
last | Position the record pointer of the result set to the last row | ||
close | Release the ResultSet object | ||
java.sql.DatabaseMetaData | A class used to obtain database metadata information, such as schema information, table information, table permission information, table column information, stored procedure information, etc. | getTables | Get the table information of the specified parameter |
getColumns | Get the column information of the specified table | ||
getPrimaryKeys | Get the primary key information of the specified table | ||
getTypeInfo | Get the data type information of the current database | ||
getExportedKeys | Get the foreign key information of the specified table | ||
java.sql.ResultSetMetaData | The class used to obtain the metadata information of the result set, such as the number of columns in the result set, the name of the column, the data type of the column, the size of the column, etc. | getColumnCount | Get the number of columns in the dataset |
getColumnName | Get the column name specified in the dataset | ||
getColumnLabel | Get the label specified in the dataset |