POSTGRESQL : parameterized servername in connection string
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: POSTGRESQL : parameterized servername in connection string

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Posts
    47

    POSTGRESQL : parameterized servername in connection string

    Hi all,
    I have just started to explore the wonders of PostgreSql. and my coding environment is VB.NET
    I am experiencing problem in connection to the database. I need to parameterize the connection string based on the server where the pgsql is installed.
    like constring = "Server=<machine_name_as_parm>;
    other parameter values can work well.
    But if change the server parameter to a different computer name, then it throw an error.
    "Unable to read data from transport connection:"

    Even the hardcoaded ip address also failed.
    my sample con string looks like this..
    strString = String.Format("Host={0};Port={1};User Id={2};Password={3};Database={4};", "172.201.0.39", "5432", "pguser", "pgpwd", "sampledb")

    (If i change the host parameter to 'localhost' it works well. But if, for some reason, the server machine changed / database shifted to other machine/pgsql then i'll pass the machine name through login screen.)

    Can anybody help in this regard?

    anticipating helpful responses...

    regards:

  2. #2
    Join Date
    Mar 2006
    Posts
    47

    SOLVED: POSTGRESQL : parameterized servername in connection string

    Solved.
    Some googling and found that i had to make an entry in pg_conf.hba to allow all hosts with full access.
    have a look at http://www.cyberciti.biz/tips/postgr...onnection.html

    Thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center