php – SQLSTATE [08001]:[Microsoft] [SQL Server的ODBC驱动程序13] TCP提供程序:无法建立连接,因为目标计算机主动拒绝它
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php – SQLSTATE [08001]:[Microsoft] [SQL Server的ODBC驱动程序13] TCP提供程序:无法建立连接,因为目标计算机主动拒绝它,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1349字,纯文字阅读大概需要2分钟。
内容图文
![php – SQLSTATE [08001]:[Microsoft] [SQL Server的ODBC驱动程序13] TCP提供程序:无法建立连接,因为目标计算机主动拒绝它](/upload/InfoBanner/zyjiaocheng/900/f5da5d3c12834275ab5abcb874e14909.jpg)
我的doctrine存储库代码不起作用,而我能够正常访问数据库并读取表数据.
我得到这个堆栈跟踪:
EntityManager->getRepository('AppBundle:Person') in src\AppBundle\Controller\PersonViewController.php (line 18)
public function indexAction(Request $request) {
$em = $this->getDoctrine()->getManager();
$repo = $em->getRepository('AppBundle:Person');
$persons = $repo->findAll();
dump($persons);
人物实体模型:
Person.php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Person
* @Package AppBundle/Entity
*
* @ORM\Entity(repositoryClass="AppBundle\Repository\PersonRepository")
* @ORM\Table(name="[Person]")
*/
class Person {
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=4)
*/
protected $type;
}
如果这也是必要的,回购代码:
PersonRepository.php
<?php
namespace AppBundle\Repository;
use /** @noinspection PhpUndefinedClassInspection */
Doctrine\ORM\EntityRepository;
class PersonRepository extends EntityRepository {
public function create() {
$entity = new Person();
$entity->type('WM_B');
$this->_em->persist($entity);
$this->_em->flush();
}
}
解决方法:
Sql Server配置管理器 – > Sql Server网络配置 – >协议 – > TCP / IP – >
我改变了以下内容
IpAll
TCP Dynamic Ports 49226
TCP Port
至:
IpAll
TCP Dynamic Ports
TCP Port 1433
不确定TCP动态端口是什么以及它们的配置原因.
内容总结
以上是互联网集市为您收集整理的php – SQLSTATE [08001]:[Microsoft] [SQL Server的ODBC驱动程序13] TCP提供程序:无法建立连接,因为目标计算机主动拒绝它全部内容,希望文章能够帮你解决php – SQLSTATE [08001]:[Microsoft] [SQL Server的ODBC驱动程序13] TCP提供程序:无法建立连接,因为目标计算机主动拒绝它所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。