Here in this topic, we will learn about how to connect SQL database using standard classes (without creating ODBC connection.
The code below uses the ODBCConnection class and LoginProperty class to connect to SQL DB.
server static ODBCConnection createConnection(str _SQLServerName, str _DatabaseName)
{
ODBCConnection connection;
LoginProperty loginProperty;
;
loginProperty = new LoginProperty();
loginProperty.setServer(_SQLServerName);
loginProperty.setDatabase(_DatabaseName);
connection = new ODBCConnection(loginProperty);
return connection;
}
It will return the connection, which can be used to execute SQL statements.
The code below uses the ODBCConnection class and LoginProperty class to connect to SQL DB.
server static ODBCConnection createConnection(str _SQLServerName, str _DatabaseName)
{
ODBCConnection connection;
LoginProperty loginProperty;
;
loginProperty = new LoginProperty();
loginProperty.setServer(_SQLServerName);
loginProperty.setDatabase(_DatabaseName);
connection = new ODBCConnection(loginProperty);
return connection;
}
It will return the connection, which can be used to execute SQL statements.
No comments:
Post a Comment