2
SQL Server에 연결되어있는 노드 응용 프로그램이 있습니다.
또한 데이터베이스를 Azure의 서비스로 사용하고 있습니다.Azure 데이터베이스에 지루함을 사용할 수 없습니다.
코드 조각은 :
import { Connection } from 'tedious';
import { Request } from 'tedious';
var config = {
userName: 'dbuser',
password: 'dbpassword',
server: 'mydatabase.database.windows.net',
options: {
instanceName: 'SQLEXPRESS', // Removed this line while deploying it on server as it has no instance.
database: 'dbname'
}
};
connection = new Connection(config);
connection.on('connect', function(err) {
if (err) {
console.log('error : '+err);
} else {
console.log("Connected to Database");
}
});
그것은 성공적으로 연결, 경우 로컬, 수행하고있다.
콘솔 출력 => 데이터베이스에 연결됨. 콘솔 로그를 사용하여 수행
깊은 다이빙 :
-> 연결 오브젝트가 작성되고 있지만, 설립 할 수 없다는있다 "CSTE 연구진은"행사.
-> 로컬에 배포 할 때 연결이 설정되지만 서버에 배포 할 때는 연결이 작동하지 않습니다.