It is possible to use a tool command line to connect to a database and extract the metadata in the necessary format to load it into Chat with Data Assistant. To do this, follow the steps below:
You can use this tool with any of the following DBMS: SQL Server, MySQL, PostgreSQL, Oracle, and SAP Hana.
Select one of the supported connection methods: JDBC or ADO.NET.
- JDBC is the only one compatible with all DBMS but requires Java installed and JAVA_HOME variable configuration.
- Connection via ADO.NET is only compatible with SQL Server.
Go to GENEXUS DEVELOPER TOOLS and download the GXqueryDBRET.zip file.
Once the download is complete, unzip the .zip file.
To select certain tables from the database, generate an XML file with the following structure. This file must contain the names of the tables you want to select:
<?xml version="1.0" encoding="utf-8"?>
<Objects>
<Object>
<ObjName>TableName1</ObjName>
</Object>
<Object>
<ObjName>TableName2</ObjName>
</Object>
</Objects>
Once the XML file is generated, you can use the -selection=<filename> argument when invoking the tool, where <filename> is the name of the XML file you created.
When running GXqueryDBRET.exe without parameters, help is displayed with the arguments that can be passed through the command line.
For example, to run it against SQL Server:
GXqueryDBRET -dbms=1 -db=PruebaGXqueryDBRET -srv=Mysql
-user=MyUserGX -pass=MyPasswordlGX -jdbc_port=1433 -jdbc_drv=3
-jdbc_clspath=C:\jdbcdrivers\mysql-jdbc-10.2.0.jar
The tool will connect to the database and, if the connection is successful, it will obtain the metadata of the tables found. Next, it will generate a file with the database name and .export extension. This file is the one to upload to the Chat with Data Assistant.