简体   繁体   中英

breeze-sequelize with MSSQL possible?

Is it currently possible to connect breeze-sequelize with a MS SQL server?

According to the doc of Sequelize , Sequelize does support MSSQL Server. Though in the breeze doc there is no MS SQL server listed.

I am a bit confused now. And if it is not possible, is the breeze dev team planning to impl that? Or are there alternatives to use breeze in nodejs with an MSSQL server?

Yes it is actually possible. It took quite some time since the breeze-sequelize documentation is not very "newb friendly".

Here is my configuration for the MS SQL server. The tempHire example from the breeze samples on github was helping out a lot.

var dbConfig = {
    user: 'username',
    password: 'secret',
    dbName: 'myDatabase'
};

var sequelizeOptions = {
    host: 'hostname',
    dialect: 'mssql',
    port: 1433
};


function createSequelizeManager() {
    var metadata = readMetadata();
    var sm = new SequelizeManager(dbConfig, sequelizeOptions);
    sm.importMetadata(metadata);

    return sm;
}

The only thing i could not figure out until now is how to communicate with a specific MS SQL instance on a host eg localhost\\MY_MSSQL_INSTANCE .

UPDATE

I actually did find out how to connect to a specific named instance.

So if you want to connect to an mssql instance like localhost\\MY_MSSQL_INSTANCE , the sequelizeOptions should look like the following:

var sequelizeOptions = {
    host: 'localhost',
    dialect: 'mssql',
    dialectOptions: {
        instanceName: 'MY_MSSQL_INSTANCE'
    }
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM