I am not sure if this is a violation of best practice or security, but I would like to throw out this sentence:
configure the ODBC connection and enable the database password in the odbc preset settings. let odbc join the DSN name and then save.
in your code, just configure the connection, for example:
try {
$conn = @odbc_connect("DSNName", "", "", "SQL_CUR_USE_ODBC");
$exec = @odbc_exec($conn, $insert) or die ("exec error");
echo "success!";
}
catch (Exception $e) {
echo $e->getMessage();
}
source
share