External
databases
Integration
with external systems where data has to been transferred is never an easy
task The
problem is, that modification for integrating an external system is often made
by two parts.
To secure that everything works well, a common platform for the
integration
must be chosen. One option is using the business connector, also referred to
as COM from
the external system as you can call any business logic within Axapta.
Consider the
business connector as an Axapta client without user interface. This will
require a
connection always open or at least always accessible.
Another option
is using an external database for storing data to be exchanged. Each
system will
then access the shared database. From Axapta, a batch job could be
configured to
schedule processing data in the external database. In this way you will be
able to
integrate two systems without having to require skills on how to communicate
directly with
the external system.
static void
DataDic_ExternalDatabase(Args _args)
{
LoginProperty
loginProperty;
ODBCConnection
odbcConnection;
Statement
statement;
ResultSet
resultSet;
ResultSetMetaData
resultSetMetaData;
Counter
counter;
;
loginProperty
= new LoginProperty();
loginProperty.setDatabase("Northwind");
loginProperty.setDSN("AX30SP4");
// Datasource name for the Axapta database
loginProperty.setUsername("sa");
// Database login name
loginProperty.setPassword("");
// Database password
odbcConnection
= new ODBCConnection(loginProperty);
statement =
odbcConnection.createStatement();
resultSet =
statement.executeQuery("select * from Employees");
resultSet.next();
resultSetMetaData
= resultSet.getMetaData();
for
(counter=1; counter <= resultSetMetaData.getColumnCount(); counter++)
{
switch
(resultSetMetaData.getColumnType(counter))
{
case 0,1 :
info(resultSet.getString(counter));
break;
case 3 :
info(date2StrUsr(resultSet.getdate(counter)));
break;
}
}
}
No comments:
Post a Comment