如何从NodeJS/Tedious连接到SQL Azure? [英] How do I connect to SQL Azure from NodeJS/Tedious?

查看:192
本文介绍了如何从NodeJS/Tedious连接到SQL Azure?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SQL Azure数据库,我正在尝试从运行在Azure Linux VM中的NodeJS应用程序连接到该数据库.当我在本地SQL数据库/和用于NodeJS的本地计算机上时,一切正常.但是,当我从vm运行时,得到以下输出(我的跟踪输出以及Tedious调试事件):

I have a SQL Azure database that I'm trying to connect to from a NodeJS application running in an Azure Linux VM. Everything works fine when I'm on a local SQL Database/and local machine for NodeJS. However, when I run from my vm, I get the following output (My trace output plus the Tedious debug event):

connected to XXXXXXX.database.windows.net:1433
State change: Connecting -> SentPrelogin
State change: SentPrelogin -> SentLogin7WithStandardLogin
connection to XXXXXXX.database.windows.net:1433 closed
State change: SentLogin7WithStandardLogin -> Final
Writing CSV files....
connection to XXXXXXX.database.windows.net:1433 closed
State change: Final -> Final
All Done!

问题在于,不会出现任何错误,但是连接似乎会自动关闭.

The problem is that no error is ever raised, but the connection seems to be automatically closed.

对这里可能发生的事情或如何解决实际错误有任何想法吗?

Any thoughts on what might be happening here or how I can get to an actual error?

推荐答案

确定-感谢此线程

有2个问题:

  1. SQL Azure需要加密的连接,因此您需要在连接选项中使用crypto:true
  2. userName配置选项需要数据库限定的名称(例如,user @ XXXXXX.database.windows.net)

以防万一其他人遇到这个问题:)

Just in case anyone else runs into this :)

这篇关于如何从NodeJS/Tedious连接到SQL Azure?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆