--- title: "Connect Lasernet Core to Databases" slug: "connect-lasernet-core-to-databases" description: "Information about Lasernet Core database connections and commands." updated: 2026-05-08T14:37:38Z published: 2026-05-08T14:37:38Z canonical: "kb.lasernetgroup.com/connect-lasernet-core-to-databases" --- > ## Documentation Index > Fetch the complete documentation index at: https://kb.lasernetgroup.com/llms.txt > Use this file to discover all available pages before exploring further. # Connect Lasernet Core to Databases **Applies to:** Lasernet Core 11 ## You can connect Lasernet Core to databases and run SQL queries and stored procedures. To do this, you must create a database connection and then use a database command. ## Database Connections To work with a database, a connection is required. The parameters required for each type of database vary, so a general overview is provided here, together with specific instructions for commonly used databases. > [!NOTE] > Note > > In addition to database connections, the **Connections** area of Lasernet Developer contains connections that are used to access Microsoft Azure services such as [SharePoint 365](/v1/docs/connect-lasernet-core-to-databases#sharepoint-365) and [Azure Storage](/v1/docs/connect-lasernet-core-to-databases#azure-storage). ![The Commands tool in Lasernet Developer.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect lasernet to databases.png) ### Connection Name A unique name used for referencing the connection in the commands. ### Server Type ![The Add Database Connection window.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/add database connection(1).png) #### OLEDB All major databases use OLEDB drivers. These are supported via the OLEDB framework which provides access to almost every function of the database. The necessary drivers for your database must be installed on the computer running Lasernet Core. They also need to be installed on the computer that runs the Lasernet Developer otherwise connections and commands cannot be tested. If Lasernet Core can’t communicate via the OLEDB provider, it will result in an error. This can typically happen if the connection string has not been defined as intended or Lasernet Core is not sharing the same 32-bit or 64-bit architecture as the OLEDB provider. In such scenarios, the error message `COM error when communicating with OleDb: Provider can’t be found. It may not be properly installed` will occur. #### ODBC To use ODBC, an external client and driver components must be installed on the computer running Lasernet Core. Any ODBC client can access a DBMS (Database Management System) for which there is an ODBC driver. DBMS server is a back-end system, for example SQL Server, Oracle and AS/400, or any DBMS for which an ODBC driver exists. ODBC drivers must be installed and maintained via the Windows ODBC Data Source Administration tool and support the same 32-bit or 64-bit architecture as Lasernet Core. ![The Windows ODBC Administration tool.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-bkp6642o.png) > [!NOTE] > Note > > When adding a database connection using ODBC in Lasernet Developer, you must copy the **Data Source Name** (in the Windows ODBC Administration tool) and paste it as the **Database / Initial Catalog** value in the **Add Database Connection** window. ![The Add Database Connection window with ODBC selected as the Server Type.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/odbc.png) #### #### SharePoint 365 This connection is used for connecting to a SharePoint server. ![The SharePoint 365 Connection Properties window.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-7nav720b.png) For more information, see the [Lasernet Core 11 SharePoint Guide](/v1/docs/lasernet-11-sharepoint-guide). #### Azure Storage This connection is used for connecting to Azure Storage. ![The Azure Storage Connection Properties window.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/azure storage connection(2).png) For more information, see the [Lasernet Core 11 Azure Guide](/v1/docs/lasernet-11-azure-guide). ### General Settings The following settings apply to only some server types. #### Connection Pooling The **Connection Pooling** option is activated by default when adding a new database connection. It works as a cache of database connections which can be reused when future requests to the database are required. Connection pools are used to enhance performance when executing commands on a database. Opening and maintaining a database connection for each user is costly and wastes resources. When using connection pooling, the connection is placed in the pool after it has been created and used repeatedly, so that a new connection does not have to be established each time. If all the connections are being used, a new connection is made and is added to the pool. Connection pooling also reduces the time a user must wait to establish a connection to the database. When exporting or migrating a database connection from an earlier version that does not support pooling, the setting will not be activated automatically. Instead, Lasernet Core will connect to the database and behave as in older versions. #### OLEDB Provider ![MSOLEDBSQL19.1 selected in the Add Database Connection window.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/oledb.png) The **OLEDB Provider** list is enabled when the server type is set to **OleDb**. There are many providers listed here however the list is not exhaustive. You can enter any provider you want to. For help with specific details for your provider, see [http://www.connectionstrings.com](http://www.connectionstrings.com/). #### Server/Data Source This is usually the name of the server on which the database server runs. It corresponds to the OleDb Data Source setting. For Microsoft Access databases, this is the full path to the .mdb file. #### Username and Password This is the username and the password for the connection. If using integrated security for OleDb and SQL Server they can be left empty and **Integrated Security=SSPI** can be set in **Custom Options**. #### Database/Initial Catalog This is the name of the database on the server. It corresponds to the OleDb **Initial Catalog** setting. For ODBC it is the name of the DSN (Data Source Name). #### Custom Options Custom Options are only used for OLEDB and give the opportunity to set any specific options needed. One setting could be Integrated Security=SSPI for SQL Server. #### Connection String The **Connection String** field is visible and read-only when a specific OLEDB provider is selected. In the case of an unsuccessful connection to a database server, you can set the connection string to **Custom (User defined)** and manually edit **Connection String**. ### Module-Specific Connections When you follow the instructions on this page, the connections that you create are available for various other elements of this Lasernet Core configuration to use. For example, [when you create a command](/v1/docs/connect-lasernet-core-to-databases#database-commands), you select a connection for it to use. Also, some modules (such as Azure Storage modules) enable you to select a connection. However, on the **Connections** tab of a module’s **Properties** window, you can create module-specific connections. The scope of these connections is limited to that module. #### Create a Module-Specific Connection To create a module-specific connection, follow these steps: 1. Navigate to the **Properties** window of the module that you want to add a connection to. 2. Click the **Connections** tab. 3. Click **Add**. 4. Select a connection type, click **OK**, and then use the information above to configure the connection. ![The Add Connection window for a module.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/create module specific connection.png) #### Copy a Connection to a Module You can copy a connection from the **Commands** area of Lasernet Developer to a module’s **Connections** tab. This action creates a module-specific connection that is distinct from the one you copied. To copy a connection to a module, follow these steps: 1. Copy the connection in the **Commands** area. ![Copy a connection from the Connections area.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/copy connection.png) 2. Paste the connection on the module’s **Connections** tab. ![Paste a connection to a module's Connections tab.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/paste connection.png) ## Database Commands Database commands are used for executing SQL queries against databases. ![The Commands tool in Lasernet Developer.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-9189iqsa.png) ### Command Name The command **Name** is a unique name which is used for referencing the database command when calling it from either a modifier point or script. ### Connection ![The DatabaseConnection JobInfo selected in the Add Connection list.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-zyj4qdiq.png) Choose the connection to execute the command through. There is a special connection in the connection list called **#DatabaseConnection#**, which instructs Lasernet Core to use the connection name in the DatabaseConnection JobInfo. This can be used for choosing the connection dynamically at runtime. ### Command Type ![Azure Storage Blob selected in the Commands list.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-8t5g6dzj.png) Once the server type for the connection is defined, you can choose the command type. The available commands are: - Command Text - Stored Procedure - SharePoint - Azure Storage Blob - Azure Storage Queue. **Command Text** and **Stored Procedure** are used for OLEDB, ODBC, and native database connections. A SharePoint command is always used with a SharePoint connection. ### Command Text This is a SQL query that is sent to the database server. The SQL query usually retrieves data from the database, or updates, inserts, or deletes data in the database. The syntax supported in the command text depends on the specific database backend used, but there are some common features which Lasernet Core makes available. One is substituting #JobInfo# markers for the content of the specified JobInfo. For example: `select * from customers where id = #CustomerID# ` In this command, `#CustomerID#` is substituted with the value of the JobInfo CustomerID when the command is run. When simple numeric values are needed, this is the preferred way to customize a `SELECT` statement. However, when using string values, this method can cause trouble. Consider this query: `select * from mytable where text = '#SomeText#' ` As before, Lasernet Core will substitute #SomeText# with the value of that JobInfo. However, if a JobInfo stores text that contains an apostrophe, the text will not be correctly substituted in the `SELECT` statement. A a result, you must use binding, which is the recommended method. The example below shows the correct syntax: `select * from mytable where text = :sometext ` Formatting the `SELECT` statement in this way makes `:sometext` a “bindable parameter”. In the **Parameters** list, the default values, data types, and so on for the parameter can now be set: ![A SQL script in the Lasernet SQL Editor.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-gfpz0vwm.png) When editing each parameter there are some options: ![SQL parameter options.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-i2ofrov6.png) The **Input Value** field is used for setting the value of the parameter. This can be any #JobInfo# references, which are automatically substituted. The **Datatype** field is used to set the type of the parameter. Usually, the database is quite strict about this setting, however some databases are capable of converting types by themselves. Generally, types like String, Double, Long (an integer) and Long binary are used. Lasernet Core also uses the type to determine how to convert input and output values. **Direction** tells Lasernet Core and the database in which direction the data from the parameter flows. **Input** means that the data flows from Lasernet Core to the database. **Output**, which is Stored Procedure specific, means that the database backend fills the parameter with some data. **Input/Output** specifies that data flows in both directions. ### Command Result In the **Tools > Command** **Result** window (of the Lasernet SQL Editor), you can specify the behavior of return values for JobInfos and specify that the command result should be generated as XML. ![Settings in the Command Result window.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-300rxt7v.png) #### Set JobInfos with Returned Values If **Set JobInfos with returned values** is selected, Lasernet Core returns data from the database into JobInfos, which are named after the column names in the table of the database. This means that if you retrieve more than one row of data from the database, you will get arrays of JobInfos containing data. It is possible to find out if anything was returned. This is done by checking the RecordCount JobInfo. If its value is 0 (zero), no records were returned. Output parameters always return a value. #### Clear JobInfos Used for Results If **Clear JobInfos used for results** is selected, Lasernet Core automatically clears the JobInfos before starting to enter data into them. #### Substitute Returned JobInfos If **Substitute Returned JobInfos** is selected, Lasernet Core will run JobInfo substitution on the returned values before storing them in JobInfos. For more information, see [JobInfo Substitution](/v1/docs/jobinfos-1#jobinfo-substitution). #### Generate XML Result Set Default data is retrieved as JobInfos from the database. It is also possible to return the data into an XML document. This is useful if data needs to be placed into a job to be rearranged in the Form Engine or the result stored into a file. Select **Generate XML result set** if you want to retrieve your database command result as an XML document. JobInfos containing field names and values from the database tables will also be created. #### JobInfo The name of the JobInfo that will contain the XML document. By setting the value to **JobData**, the primary job parsing through Lasernet Core will now consist of the XML result set. #### Root Tag Name The root tag name of the XML document. #### XML Encoding The XML encoding to be used in the XML document. #### Table Tag Name Specifies which tag name (if any) is used for the table. If **No table tag** is selected, the attribute is placed on the root tag. **Record count as attribute** sets the value of the RecordCount attribute to the number of records returned from the database. #### Record Tag Name For each record returned from the database, this tag is used to enclose the records. **Record number as attribute** sets the number of the record (starting from zero) in the attribute specified. #### Field Tag Name Specifies how to store the value in the XML document for each field in each record. **Tags with field name** adds a tag for each field with the tag name set to the field name. **Tags with this name** adds a tag with the given name for each field. **Attributes on record tag** adds the field values as attributes on the record tag. Each attribute has the name from the field. **Attributes on this tag** adds one tag with the given name and sets the values as attributes on that tag. #### Binary Values Choose how to handle binary values: - **Hex encode** encodes the value in this format in hex format. - **Base 64 encode** encodes the value in this Base 64 format. - **Ignore** ignores binary values. **Example** In this example all rows from the table `MAIL_DB` are selected where the field `CustNo` is equal to `44756404`. `select * from MAIL_DB where CustNo = '44756404'` ![Query results.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-bbkv0ao1.png) In the Database Command modifier, **Generate XML result set** is selected and the parameters are defined as follows: - XML encoding is set to UTF-8. - Root tag named `<LaserNet>` with record count defined as an attribute (two records are selected). - Each record includes `<Row>` with ID defined as an attribute containing the record number. - Tags selected from the table are named with field names and the value of the field is added. The result is an XML document stored into the DBData JobInfo with the following structure. ![A screenshot of a computer code AI-generated content may be incorrect.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-93o15ul7.png) Other variants of the XML document can be defined by setting the appropriate properties. ### DataTable Relations Between Queries in Database Command You can specify how DataTables are related, making it possible to have master/detail relationship. This enables you to mail merge or create reports, for example, with customers and their orders, based on your query. ## Stored Procedures Calling a stored procedure is as easy as picking a database connection, selecting which procedure to call and filling in the parameters accordingly. Lasernet Core supports input and output parameters as well as a return value from the procedure (OLEDB connections only). Features may vary depending on the backend used. For example, Lasernet Core reads the possible parameters from some backends (SQL Server, Oracle, MySQL), while for others it is up to the user to add parameters manually via the **Add** and **Remove** buttons in the toolbar. ![The Edit Command Parameter window.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-4hidtqwk.png) Parameter values support JobInfo substitution. Parameters can have different directions; **Input**, **Output**, **Input & Output** and **Return**. - **Input**: Is sent to the backend. - **Output**: Parameter is filled with value set in backend. - **Input & Output**: Is sent to the backend and filled with value set in the backend. - **Return**: A procedure can return an integer value called a return code to indicate the execution status of a procedure. The returned values are inserted into JobInfos with the name of the parameter. The return value is sent in the JobInfo RETURN_VALUE. For example: ![Two JobInfos circled in the JobInfos pane of the Lasernet SQL Editor.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-x8wjs8zl.png) ![The Output Value property of two JobInfos circled in the Parameters pane of the Lasernet SQL Editor.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-200t775u.jpg) Datasets returned from a stored procedure are either inserted as JobInfos or as XML in JobData exactly like running a ‘Command Text’. ## Executing a Query in Transaction or Without Transaction The **Execute** or **Execute in transaction** button in the toolbar is used for testing queries directly from the SQL Editor. ![A SQL script in the Lasernet SQL Editor.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-k1n33kgs.png) ### Execute In Transaction It can be advantageous to execute queries without actually changing the data in the database, especially when testing. For this reason, this is the default behavior of the software, in order to prevent making accidental changes to the database. The feature issues a `BEGIN TRANSACTION` before executing the query and afterwards does a `ROLLBACK TRANSACTION`. Log and result sets show changes as they were at the time. Multiple changes and selects can be done simultaneously in the same transaction, if each query is terminated with a semi colon. `INSERT INTO Customer (FirstName, LastName) VALUES ("John", "Doe");` `SELECT * FROM Customer WHERE LastName = "Doe";` ### Execute (Without Transaction) **Execute** works identically to **Execute in transaction** except the `BEGIN TRANSACTION` and `ROLLBACK TRANSACTION` are not issued. This means the changes made to the database are permanent. ### Executing Partial Queries When having a several queries separated by semicolon, it can be useful to only execute a few of them. This can be done by selecting just the text covering the queries and then executing the query. ## Table Editor The table editor is built into the SQL Editor. You need a working connection to a database before you can manipulate tables in it. The table editor is only supported on a small subset of the supported backends in Lasernet Core. The table editor is accessed via the Object Explorer using the **Add Table** or **Edit Table** option. ![The Add Table menu item selected in the Table Editor.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-72g4jx64.png) The features available in the table editor depend on the backend used. For example, some backends do not support the renaming of columns. ![The New Table window.](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/connect-lasernet-generate-to-databases-image-nvlakbn1.png) A table name must be specified and at least one column added to the table. The specified datatype of the columns will reveal or lock out additional features; for example, precision of doubles. The default value is used when inserting rows in the table where the column is not specified and given a value. The Pseudo code example is for advanced users who want to know exactly how the column is created (SQL query sent to backend). Relations between tables cannot be manipulated with the SQL/Table Editor, but must be done either with other software or via manually created SQL queries.