如何在UBUNTU上安装SQL Server Native Client 11.0?

时间:2016-11-28 11:02:40

标签: sql-server ubuntu-16.04

是否有关于如何在Ubuntu上安装SQL Server Native Client的教程。原因如下图像我想配置DSN。

/etc/odbc.ini

[login]
// Driver = SQL Server Native Client // the driver is not working
// but when I used the 
Driver = ODBC Driver 13 for SQL Server // is now working
Server = myhost.com 
Database = MYDATABASE_DBF

enter image description here

2 个答案:

答案 0 :(得分:2)

有几种方法可以连接到SQL Server。本机客户端是一个。但微软并不建议您进行新的开发工作。在您的情况下,您可能需要用于SQL Server的Microsoft ODBC驱动程序。有关详情,请参阅@HongOoi提供的the link

This link包含Microsoft提供的有关其支持的各种连接选项的概述。它包含对本机客户端的评论:

  

SQL Server Native Client OLE DB提供程序包含在SQL Server 2005,SQL Server 2008,SQL Server 2008 R2和SQL Server 2012中的SQL Server Native Client中。在SQL Server 2012之后,SQL Server Native Client OLE DB提供程序将不再包含在SQL Server Native Client中。

     

在SQL Server 2012之后,ODBC驱动程序将更新   最近的服务器功能,包括Microsoft Windows Azure SQL   数据库,并作为SQL Server的Microsoft ODBC驱动程序发布。

答案 1 :(得分:0)

在Mint(Tara)上,我安装了msodbcsql17。它连接到Windows服务器上的SQLServer 2008R2。

void ContentLoader::WritePixelsToShaderIndex(uint32_t *data, int width, int height, int index)
{
    D3D11_TEXTURE2D_DESC desc = {};
    desc.Width = width;
    desc.Height = height;
    desc.MipLevels = 1;
    desc.ArraySize = 1;
    desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    desc.SampleDesc.Count = 1;
    desc.SampleDesc.Quality = 0;
    desc.Usage = D3D11_USAGE_DEFAULT;
    desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
    desc.CPUAccessFlags = 0;
    desc.MiscFlags = 0;

    D3D11_SUBRESOURCE_DATA initData;
    initData.pSysMem = data;
    initData.SysMemPitch = width * 4;
    initData.SysMemSlicePitch = width * height * 4;

    Microsoft::WRL::ComPtr<ID3D11Texture2D> tex;

    Engine::device->CreateTexture2D(&desc, &initData, tex.GetAddressOf());

    Engine::device->CreateShaderResourceView(tex.Get(), NULL, ContentLoader::GetTextureAddress(index));
}

我的配置到TEST数据库:/etc/odbc.ini

const int WIDTH = 200;
const int HEIGHT = 200;
const uint32_t RED = 255 | (0 << 8) | (0 << 16) | (255 << 24);
const uint32_t WHITE = 255 | (255 << 8) | (255 << 16) | (255 << 24);
const uint32_t BLUE = 0 | (0 << 8) | (255 << 16) | (255 << 24);
uint32_t *buffer = new uint32_t[WIDTH * HEIGHT];
bool flip = false;
for (int X = 0; X < WIDTH; ++X)
{
    for (int Y = 0; Y < HEIGHT; ++Y)
    {
        int pixel = X + Y * WIDTH;
        buffer[pixel] = flip ? BLUE : WHITE;
    }
    flip = true;
}

WritePixelsToShaderIndex(buffer, WIDTH, HEIGHT, 3);
delete [] buffer;

注意:/etc/odbcinst.ini是自动创建的。

测试连接:isql MSDB USER PWD