Skip to content

Commit

Permalink
添加达梦驱动
Browse files Browse the repository at this point in the history
  • Loading branch information
NoneDay committed Dec 14, 2023
1 parent 7adba84 commit bafe3fb
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 34 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ Database=dbname;Data Source=x.x.x.x;Port=3306;User Id=xxx;Password=****;Charset=
pgsql 连接串 格式
server=ip地址;port=5432;uid=用户;pwd=口令;database=数据库;Pooling=true;
达梦 连接串 格式
Server=ip地址:端口; UserId=用户; PWD=口令;
```

配置完毕后,按F5 刷新页面,点报表目录,正常的话,这是应该能看到所有的测试报表了
Expand Down
3 changes: 2 additions & 1 deletion end/reportWeb/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ public void ConfigureServices(IServiceCollection services)
DbProviderFactories.RegisterFactory("Microsoft.Data.Sqlite", SqliteFactory.Instance);
foreach(var one in Configuration.GetSection("DbProviderFactories").Get<DbProviderCfg[]>())
{
var ass = System.Reflection.Assembly.Load( one.DllName);
//var ass = System.Reflection.Assembly.Load( one.DllName);
var ass = System.Reflection.Assembly.LoadFrom(Path.GetDirectoryName(Environment.ProcessPath) + "/" + one.DllName + (one.DllName.EndsWith(".dll")?"":".dll"));
DbProviderFactory f = ass.GetType(one.FactoryClass).GetField(one.InstanceName).GetValue(null) as DbProviderFactory;
DbProviderFactories.RegisterFactory(one.Name, f );

Expand Down
77 changes: 44 additions & 33 deletions end/reportWeb/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,49 @@
"admin_user": "admin",
"admin_password": "database!123",
//"static_path": "",
"DbProviderFactories": [
{
"name": "SqlClient",
"dllName": "Microsoft.Data.SqlClient",
"FactoryClass": "Microsoft.Data.SqlClient.SqlClientFactory",
"InstanceName": "Instance"
},
{
"name": "Oracle",
"dllName": "Oracle.ManagedDataAccess",
"FactoryClass": "Oracle.ManagedDataAccess.Client.OracleClientFactory",
"InstanceName": "Instance"
},
{
"name": "Npgsql",
"dllName": "Npgsql",
"FactoryClass": "Npgsql.NpgsqlFactory",
"InstanceName": "Instance"
},
"DbProviderFactories": [
{
"name": "SqlClient",
"dllName": "Microsoft.Data.SqlClient",
"FactoryClass": "Microsoft.Data.SqlClient.SqlClientFactory",
"InstanceName": "Instance",
"link_str": "Data Source=ip地址;Initial Catalog=数据库名字;Persist Security Info=True;User ID=用户;Password=口令;Min Pool Size=1;Max Pool Size=50;Connect Timeout=15000;Application Name=报表连接,"
},
{
"name": "Oracle",
"dllName": "Oracle.ManagedDataAccess",
"FactoryClass": "Oracle.ManagedDataAccess.Client.OracleClientFactory",
"InstanceName": "Instance",
"link_str": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ip地址)(PORT=端口))(CONNECT_DATA=(SERVER = SERVER名字)(SERVICE_NAME = 数据库)));User Id=用户;Password=口令;",
},
{
"name": "Npgsql",
"dllName": "Npgsql",
"FactoryClass": "Npgsql.NpgsqlFactory",
"InstanceName": "Instance",
"link_str": "server=ip地址;port=5432;uid=用户;pwd=口令;database=数据库;Pooling=true;"
},

{
"name": "MySql",
"dllName": "MySql.Data",
"FactoryClass": "MySql.Data.MySqlClient.MySqlClientFactory",
"InstanceName": "Instance",
"link_str": "Database=dbname;Data Source=x.x.x.x;Port=3306;User Id=xxx;Password=****;Charset=utf8;TreatTinyAsBoolean=false;"
},
{
"name": "odbc",
"dllName": "System.Data.Odbc",
"FactoryClass": "System.Data.Odbc.OdbcFactory",
"InstanceName": "Instance"
}
]
{
"name": "MySql",
"dllName": "MySql.Data",
"FactoryClass": "MySql.Data.MySqlClient.MySqlClientFactory",
"InstanceName": "Instance",
"link_str": "Database=dbname;Data Source=x.x.x.x;Port=3306;User Id=xxx;Password=****;Charset=utf8;TreatTinyAsBoolean=false;"
},
{
"name": "odbc",
"dllName": "System.Data.Odbc",
"FactoryClass": "System.Data.Odbc.OdbcFactory",
"InstanceName": "Instance",
"link_str":"Dsn=odbc数据源名称;"
},
{
"name": "DaMeng",
"dllName": "DmProvider",
"FactoryClass": "Dm.DmClientFactory",
"InstanceName": "Instance",
"link_str": "Server=ip地址:端口; UserId=用户; PWD=口令;"
}
]
}
1 change: 1 addition & 0 deletions end/reportWeb/reportWeb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ItemGroup>
<PackageReference Include="Antlr3.Runtime" Version="3.5.2-rc1" />
<PackageReference Include="CSRedisCore" Version="3.6.6" />
<PackageReference Include="dmdbms.DmProvider" Version="1.1.0.16649" />
<PackageReference Include="EPPlus" Version="6.2.7" />
<PackageReference Include="itext7" Version="7.2.1" />
<PackageReference Include="itext7.pdfhtml" Version="4.0.1" />
Expand Down

0 comments on commit bafe3fb

Please sign in to comment.