Article From:https://segmentfault.com/q/1010000010373824
Question:

UbuntuVersion: 16.0.4
.net coreVersion: 1.1
Wrote a test case and found that the console procedure is the same.
The program uses the sqlSugarCore component to access the database

The question now is:
It can connect to the remote database in window, but Linux can’t do it.
Sqlserver access that can be normally accessed in LAN in Linux

sudo service ufw stop The firewall doesn’t seem to have anything to do with it.

So it is doubted whether Linux needs to be set up to connect to sqlserver service.

Find this issues:https://github.com/dotnet/cor in GitHub…
It seems to say the 1.1 solution. But my name is 1.1~~

Test code

Program.csCode

using System;
using SqlSugar;

namespace mssqlCoreDemo
{
    class Program
    {
        //LinuxLower remote database link failurePublic const string ConnectionString = "server= remote SQLSERVER database; database=test; uid=s"A; pwd=123456 ";Static void Main (string[] args){Console.WriteLIne ("start");Using (VaR DB = new SqlSugarClient (New ConnectionConfig ()) {ConnectionStrIng = ConnectionString, DbType = DbType.SqlServer}){Console.WriteLinE ("Connect Database:" +db.Ado.GetScalar ("select 233").ToString ());}Console.WriteLine ("end");}}}

mysqlCoreDemo.csprojCode

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="sqlSugarCore" Version="4.2.1.9" />
  </ItemGroup>
</Project>

The exception log after the link timeout is as follows

Answer 0:

.net core The program connects to SQLSERVER database under Linux, and the SqlServer version must be larger than SQL Server 2008 SP4.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *