title: MS SQL JDBC error on Execution exception - Invalid object name [Play 2.x scala app]
body: <p>I'm using Play framework 2.x with SQL driver: com.microsoft.sqlserver.jdbc.SQLServerDriver</p>
  
  <p>I'm trying to run a simple query:</p>
  
  <pre><code>SELECT [org].[name] FROM [ref].[organisations_bak] AS org
  </code></pre>
  
  <p>but I get the following error:</p>
  
  <pre><code>play.api.Application$$anon$1: Execution exception[[SQLServerException: Invalid object name 'ref.organisations_bak'.]]
  at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10-2.2.2.jar:2.2.2]
  at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10-2.2.2.jar:2.2.2]
  at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:165) [play_2.10-2.2.2.jar:2.2.2]
  at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:162) [play_2.10-2.2.2.jar:2.2.2]
  at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33) [scala-library-2.10.3.jar:na]
  at scala.util.Failure$$anonfun$recover$1.apply(Try.scala:185) [scala-library-2.10.3.jar:na]
  Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'ref.organisations_bak'.
  at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) ~[sqljdbc4-4.0.2206.100.jar:na]
  at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515) ~[sqljdbc4-4.0.2206.100.jar:na]
  at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:792) ~[sqljdbc4-4.0.2206.100.jar:na]
  at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:689) ~[sqljdbc4-4.0.2206.100.jar:na]
  at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) ~[sqljdbc4-4.0.2206.100.jar:na]
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) ~[sqljdbc4-4.0.2206.100.jar:na]
  </code></pre>
  
  <p>I need to use the schema reference in my queries but I cant even get a simple query like this to work on my play app, simple queries without schema references work fine </p>
  
  <pre><code>SELECT name FROM organisations_bak
  </code></pre>
  
  <p>My Scala code looks like this:</p>
  
  <pre><code>import java.sql.ResultSet
  import play.api.db.DB
  DB.withConnection {
      conn =&gt;
          val res = conn.createStatement.execute("SELECT [org].[name] FROM [ref].[organisations_bak] AS org")
  }
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thanks</p>