title: yii2 use dblib driver SQLSTATE[HY000]: General error: 20018 Invalid object name t_user
body: <p>I have use dblib driver in my project ,
  but execute  query exception</p>
  <pre><code>Database Exception – yii\db\Exception
  SQLSTATE[HY000]: General error: 20018 Invalid object name 't_user'. [20018] (severity 16) [select top 10 * from t_user]
  The SQL being executed was: select top 10 * from t_user
  Error Info: Array
  (
      [0] =&gt; HY000
      [1] =&gt; 20018
      [2] =&gt; Invalid object name 't_user'. [20018] (severity 16) [select top 10 * from t_user]
      [3] =&gt; -1
      [4] =&gt; 16
  )
  ↵
  Caused by: PDOException
  SQLSTATE[HY000]: General error: 20018 Invalid object name 't_user'. [20018] (severity 16) [select top 10 * from t_user]
  </code></pre>
  <p>If I use native PHP, it's OK</p>
  <pre><code>&lt;?php
  
   $dbh = new PDO(&quot;dblib:host=;dbname=&quot;,&quot;&quot;,&quot;&quot;);
  
  $query = $dbh-&gt;prepare(&quot;SELECT top 1 * from t_user&quot;);
  $query-&gt;execute();
  while($row = $query-&gt;fetch()){
          print_r($row);
  }
  </code></pre>
  <p>I install freetds php_dblib</p>
  <p>The configuration information</p>
  <pre><code>➜  www /usr/local/Cellar/freetds/1.1.40/bin/tsql -C
  Compile-time settings (established with the &quot;configure&quot; script)
                              Version: freetds v1.1.40
               freetds.conf directory: /usr/local/etc
       MS db-lib source compatibility: no
          Sybase binary compatibility: yes
                        Thread safety: yes
                        iconv library: yes
                          TDS version: 7.3
                                iODBC: no
                             unixodbc: yes
                SSPI &quot;trusted&quot; logins: no
                             Kerberos: yes
                              OpenSSL: yes
                               GnuTLS: no
                                 MARS: yes
  ➜  www php -v
  PHP 7.3.18 (cli) (built: May 29 2020 02:17:25) ( NTS )
  Copyright (c) 1997-2018 The PHP Group
  Zend Engine v3.3.18, Copyright (c) 1998-2018 Zend Technologies
      with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
      with Zend OPcache v7.3.18, Copyright (c) 1999-2018, by Zend Technologies
  ➜  www php -m | grep dblib
  pdo_dblib
  ➜  www php --ri pdo_dblib
  
  pdo_dblib
  
  PDO Driver for FreeTDS/Sybase DB-lib =&gt; enabled
  Flavour =&gt; freetds
  </code></pre>
  <p>the yii2 config  [ use yii2 basic 2.0.x]</p>
  <pre><code> &lt;?php
  
  return [
      'class' =&gt; 'yii\db\Connection', // yii connection
      'dsn' =&gt; 'dblib:host=;database=', // this is dblib
      'username' =&gt; '', // user name 
      'password' =&gt; '', // password
      'charset' =&gt; 'utf8',
  ];
  </code></pre>
  <p>I don't know how to tackle this problem。
  Ask for help, Daniel~</p>