当我尝试将python与SQL Server连接时,发生以下错误.
"pyodbc.Error:('08001','[08001] [Microsoft] [ODBC SQL Server驱动程序] [DBNETLIB] SQL Server不存在或访问被拒绝.(17)(SQLDriverConnect)')"
以下是我的代码.
import pyodbc
connection = pyodbc.connect("Driver={SQL Server}; Server=localhost;
Database=emotionDetection; uid=uname ;pwd=pw;Trusted_Connection=yes")
cursor = connection.cursor()
SQLCommand = ("INSERT INTO emotion" "(happy, sad, angry) "
"VALUES (?,?,?)")
Values = ['smile','cry','blame']
cursor.execute(SQLCommand,Values)
connection.commit()
connection.close()
Run Code Online (Sandbox Code Playgroud)
这是我第一次尝试将Python连接到sql server.我不知道驱动程序名称,服务器名称,用户名和密码是什么.你知道我的配置应该是什么.请帮我.
当我尝试使用 PHP SMTP 电子邮件服务器发送电子邮件时,发生了以下错误。
SMTP Error: Could not authenticate. Message could not be sent.
Run Code Online (Sandbox Code Playgroud)
邮件程序错误:SMTP 错误:无法进行身份验证。
以下是我使用过的代码。
function supervisorMail(){
global $error;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = "***@gmail.com";
$mail->Password = "****";
$mail->SetFrom("***@gmail.com", "Employee Leave Management System");
$userID=$_SESSION['userID'];
$select_query = mysql_query("SELECT * FROM employee WHERE emp_id = '$userID'");
$select_sql = mysql_fetch_array($select_query);
$name=$select_sql['manager_name'];
var_dump($name);
$select_query1 = mysql_query("SELECT email FROM employee WHERE emp_id='$name'");
$select_sql1 = mysql_fetch_array($select_query1);
$email=$select_sql1['email']; …Run Code Online (Sandbox Code Playgroud)