无法连接到该IP地址 [英] not able to connect at this ip address
问题描述
我已经使用此代码通过其IP 192.168.1.13与我的朋友postgresql数据库进行连接,但是在连接时显示无法在此192.168.1.13地址上连接.............但是我使用"Server = 127.0.0.1; Port = 5432; Database = fastek; User Id = postgres; Password = atul;";
作为连接字符串,它将成功连接到我的数据库....plz告诉我postgresql连接是否需要其他任何属性.下面给出了我的代码
i have used this code to connect with my friends postgresql data base with their ip 192.168.1.13 but while connecting show not able to connect at this 192.168.1.13 address ............ but if i use "Server=127.0.0.1;Port=5432;Database=fastek;User Id=postgres;Password=atul;";
as a connection string it connect to my database successfully.... plz tell me if any other properties are required for postgresql connection.below my code is given
string connectionString = "Server=192.168.1.13;Port=5432;Database=CRM;User Id=postgres;Password=jeetsingh;Integrated Security=true;";
System.Data.IDbConnection dbcon;
dbcon = new NpgsqlConnection(connectionString);
dbcon.Open();
System.Data.IDbCommand dbcmd = dbcon.CreateCommand();
string sql = "select table_name from information_schema.tables where table_schema NOT IN (''pg_catalog'', ''information_schema'');";
dbcmd.CommandText = sql;
System.Data.IDataReader reader = dbcmd.ExecuteReader();
DropDownList3.DataSource = reader;
DropDownList3.DataValueField = "table_name";
DropDownList3.DataTextField = "table_name";
DropDownList3.DataBind();
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
推荐答案
尝试链接此
try link this
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
另请参见此链接 http://connectionstrings.com/postgre-sql
谢谢
--RA
see this link also http://connectionstrings.com/postgre-sql
Thanks
--RA
这篇关于无法连接到该IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!