尝试连接到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”.