c#-找不到远程主机“.”错误

尝试连接到DB2数据库时出现以下错误.

SQL1336N The remote host “.” was not found. SQLSTATE=08001

DB2 Express安装在我的本地机器上,并且使用命令窗口在数据库中创建了一些表.

克服此错误的主机名应该是什么?

   string connectionString= @"Provider = IBMDADB2; Database = MYDATABASE; Hostname = .; Protocol = TCPIP; Port = 50000; Uid = xxx123; Pwd = dddd@454";
   OleDbConnection myConnection = new OleDbConnection();
   myConnection.ConnectionString = connectionString;
   myConnection.Open();

解决方法:

也许您应该尝试将主机名设置为本地ip或“ localhost”.

上一篇:java-在DB2 10.5中使用DB2 load命令加载数据时出错


下一篇:Spring JPA CrudRepository save(Entity)在id字段中返回0