1

I'm using default PHP 5.3.10 in my ubuntu box. and install php5-sysbase.

I tested with this code and success connected to my SQL Server

<?php
        $link = mssql_connect('125.0.0.1', 'sa', '12345');
        if(!$link) {
                echo'Could not connect';
                die('Could not connect: ' . mssql_error());
        }
        echo'Successful connection';
        mssql_close($link);

Now I'm following the quickstart tutorial until arrive at database things in http://laravel.com/docs/quick#creating-a-migration

I use default db driver sqlsrv, with this config:

'sqlsrv' => array(
            'driver'   => 'sqlsrv',
            'host'     => '125.0.0.1',
            'database' => 'laravel',
            'username' => 'sa',
            'password' => '12345',
            'prefix'   => '',
        ),

When I execute php artisan migrate, I got an error

[Exception]
  SQLSTATE[HY000]: General error: 102 General SQL Server error: Check message
  s from the SQL Server [102] (severity 15) [(null)] (SQL: create table "migr
  ations" ("migration" nvarchar(255) not null, "batch" int not null)) (Bindin
  gs: array (
  ))

What could be the problem? Thanks for any helps

EDIT01:

here's sql message:

message_id  language_id severity    is_event_logged text
102 1033    15  0   Incorrect syntax near '%.*ls'.

here's my migration file:

<?php

use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function($table)
        {
            $table->increments('id');
            $table->string('email')->unique();
            $table->string('name');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }

}
4

1 回答 1

2
/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php

Change this:

protected $wrapper = '"%s"';

To this:

protected $wrapper = '[%s]';
于 2013-08-01T15:18:48.450 回答