connect method
Future<bool>
connect({
- required String ip,
- required String port,
- required String databaseName,
- required String username,
- required String password,
- int timeoutInSeconds = 30,
override
Connects to the SQL Server database.
The required parameters are the IP address, port, database name, username, password, and an optional timeout in seconds.
Implementation
@override
Future<bool> connect({
required String ip,
required String port,
required String databaseName,
required String username,
required String password,
int timeoutInSeconds = 30,
}) async {
try {
var invokeMethod = await methodChannel.invokeMethod<bool>(
'connectDb',
{
'url': "jdbc:jtds:sqlserver://$ip:$port/$databaseName",
'username': username,
'password': password,
'timeoutInSeconds': timeoutInSeconds,
},
) ??
false;
return invokeMethod;
} catch (e) {
rethrow;
}
}