const mssql = require('mssql')
const {argv} = require('yargs')

async function main(user,password,host,database) {
    try {
        await mssql.connect(`mssql://${user}:${escape(password)}@${host}/${database}`)
        console.log("OK")
    } catch (error) {
        console.log("ERRO")
    }
}

async function exec() {
    const user = argv["user"]
    const password = argv["password"]
    const host = argv["host"]
    const database = argv["database"]

    main(user,password,host,database).then(() => process.exit(0)).catch(() => process.exit(0))
}

exec()