PostgreSQL Connection URL












101














How is the PostgreSQL connection URL formed, when the host is some other computer than the localhost?



I have allowed PostgreSQL to accept requests from outside.










share|improve this question
























  • Drivers? Language?
    – Milen A. Radev
    Aug 27 '10 at 10:30
















101














How is the PostgreSQL connection URL formed, when the host is some other computer than the localhost?



I have allowed PostgreSQL to accept requests from outside.










share|improve this question
























  • Drivers? Language?
    – Milen A. Radev
    Aug 27 '10 at 10:30














101












101








101


29





How is the PostgreSQL connection URL formed, when the host is some other computer than the localhost?



I have allowed PostgreSQL to accept requests from outside.










share|improve this question















How is the PostgreSQL connection URL formed, when the host is some other computer than the localhost?



I have allowed PostgreSQL to accept requests from outside.







postgresql database-connection






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 23 '18 at 13:28









Arturo Herrero

8,66363267




8,66363267










asked Aug 27 '10 at 8:43









JIIJII

544269




544269












  • Drivers? Language?
    – Milen A. Radev
    Aug 27 '10 at 10:30


















  • Drivers? Language?
    – Milen A. Radev
    Aug 27 '10 at 10:30
















Drivers? Language?
– Milen A. Radev
Aug 27 '10 at 10:30




Drivers? Language?
– Milen A. Radev
Aug 27 '10 at 10:30












5 Answers
5






active

oldest

votes


















211














If you use Libpq binding for respective language, according to its documentation URI is formed as follows:



postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]


Here are examples from same document



postgresql://
postgresql://localhost
postgresql://localhost:5432
postgresql://localhost/mydb
postgresql://user@localhost
postgresql://user:secret@localhost
postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
postgresql://localhost/mydb?user=other&password=secret





share|improve this answer



















  • 10




    This workded for me postgres://user:secret@localhost:5432/mydatabasename
    – George Livingston
    Feb 16 '18 at 15:04












  • postgresql://localhost/mydb?user=other&password=secret did the trick
    – Karuhanga
    Oct 29 '18 at 14:31



















14














Here is the documentation for JDBC, the general URL is "jdbc:postgresql://host:port/database"



Chapter 3 here documents the ADO.NET connection string,
the general connection string is Server=host;Port=5432;User Id=username;Password=secret;Database=databasename;



PHP documentation us here, the general connection string is
host=hostname port=5432 dbname=databasename user=username password=secret



If you're using something else, you'll have to tell us.






share|improve this answer





























    5














    The following worked for me



    var conString = "postgres://YourUserName:YourPassword@YourHost:5432/YourDatabase";





    share|improve this answer





























      2














      the connection url for postgres
      syntax:



      "Server=host ipaddress;Port=5432;Database=dbname;User Id=userid;Password=password;


      example:



      "Server=192.168.1.163;Port=5432;Database=postgres;User Id=postgres;Password=root;





      share|improve this answer





























        0














        host or hostname would be the i.p address of the remote server, or if you can access it over the network by computer name, that should work to.






        share|improve this answer





















          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3582552%2fpostgresql-connection-url%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          211














          If you use Libpq binding for respective language, according to its documentation URI is formed as follows:



          postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]


          Here are examples from same document



          postgresql://
          postgresql://localhost
          postgresql://localhost:5432
          postgresql://localhost/mydb
          postgresql://user@localhost
          postgresql://user:secret@localhost
          postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
          postgresql://localhost/mydb?user=other&password=secret





          share|improve this answer



















          • 10




            This workded for me postgres://user:secret@localhost:5432/mydatabasename
            – George Livingston
            Feb 16 '18 at 15:04












          • postgresql://localhost/mydb?user=other&password=secret did the trick
            – Karuhanga
            Oct 29 '18 at 14:31
















          211














          If you use Libpq binding for respective language, according to its documentation URI is formed as follows:



          postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]


          Here are examples from same document



          postgresql://
          postgresql://localhost
          postgresql://localhost:5432
          postgresql://localhost/mydb
          postgresql://user@localhost
          postgresql://user:secret@localhost
          postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
          postgresql://localhost/mydb?user=other&password=secret





          share|improve this answer



















          • 10




            This workded for me postgres://user:secret@localhost:5432/mydatabasename
            – George Livingston
            Feb 16 '18 at 15:04












          • postgresql://localhost/mydb?user=other&password=secret did the trick
            – Karuhanga
            Oct 29 '18 at 14:31














          211












          211








          211






          If you use Libpq binding for respective language, according to its documentation URI is formed as follows:



          postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]


          Here are examples from same document



          postgresql://
          postgresql://localhost
          postgresql://localhost:5432
          postgresql://localhost/mydb
          postgresql://user@localhost
          postgresql://user:secret@localhost
          postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
          postgresql://localhost/mydb?user=other&password=secret





          share|improve this answer














          If you use Libpq binding for respective language, according to its documentation URI is formed as follows:



          postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]


          Here are examples from same document



          postgresql://
          postgresql://localhost
          postgresql://localhost:5432
          postgresql://localhost/mydb
          postgresql://user@localhost
          postgresql://user:secret@localhost
          postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
          postgresql://localhost/mydb?user=other&password=secret






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 16 '18 at 17:05









          Mike 'Pomax' Kamermans

          27.5k65797




          27.5k65797










          answered Dec 21 '13 at 18:37









          AndreyAndrey

          2,331186




          2,331186








          • 10




            This workded for me postgres://user:secret@localhost:5432/mydatabasename
            – George Livingston
            Feb 16 '18 at 15:04












          • postgresql://localhost/mydb?user=other&password=secret did the trick
            – Karuhanga
            Oct 29 '18 at 14:31














          • 10




            This workded for me postgres://user:secret@localhost:5432/mydatabasename
            – George Livingston
            Feb 16 '18 at 15:04












          • postgresql://localhost/mydb?user=other&password=secret did the trick
            – Karuhanga
            Oct 29 '18 at 14:31








          10




          10




          This workded for me postgres://user:secret@localhost:5432/mydatabasename
          – George Livingston
          Feb 16 '18 at 15:04






          This workded for me postgres://user:secret@localhost:5432/mydatabasename
          – George Livingston
          Feb 16 '18 at 15:04














          postgresql://localhost/mydb?user=other&password=secret did the trick
          – Karuhanga
          Oct 29 '18 at 14:31




          postgresql://localhost/mydb?user=other&password=secret did the trick
          – Karuhanga
          Oct 29 '18 at 14:31













          14














          Here is the documentation for JDBC, the general URL is "jdbc:postgresql://host:port/database"



          Chapter 3 here documents the ADO.NET connection string,
          the general connection string is Server=host;Port=5432;User Id=username;Password=secret;Database=databasename;



          PHP documentation us here, the general connection string is
          host=hostname port=5432 dbname=databasename user=username password=secret



          If you're using something else, you'll have to tell us.






          share|improve this answer


























            14














            Here is the documentation for JDBC, the general URL is "jdbc:postgresql://host:port/database"



            Chapter 3 here documents the ADO.NET connection string,
            the general connection string is Server=host;Port=5432;User Id=username;Password=secret;Database=databasename;



            PHP documentation us here, the general connection string is
            host=hostname port=5432 dbname=databasename user=username password=secret



            If you're using something else, you'll have to tell us.






            share|improve this answer
























              14












              14








              14






              Here is the documentation for JDBC, the general URL is "jdbc:postgresql://host:port/database"



              Chapter 3 here documents the ADO.NET connection string,
              the general connection string is Server=host;Port=5432;User Id=username;Password=secret;Database=databasename;



              PHP documentation us here, the general connection string is
              host=hostname port=5432 dbname=databasename user=username password=secret



              If you're using something else, you'll have to tell us.






              share|improve this answer












              Here is the documentation for JDBC, the general URL is "jdbc:postgresql://host:port/database"



              Chapter 3 here documents the ADO.NET connection string,
              the general connection string is Server=host;Port=5432;User Id=username;Password=secret;Database=databasename;



              PHP documentation us here, the general connection string is
              host=hostname port=5432 dbname=databasename user=username password=secret



              If you're using something else, you'll have to tell us.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Aug 27 '10 at 8:53









              nosnos

              175k43317426




              175k43317426























                  5














                  The following worked for me



                  var conString = "postgres://YourUserName:YourPassword@YourHost:5432/YourDatabase";





                  share|improve this answer


























                    5














                    The following worked for me



                    var conString = "postgres://YourUserName:YourPassword@YourHost:5432/YourDatabase";





                    share|improve this answer
























                      5












                      5








                      5






                      The following worked for me



                      var conString = "postgres://YourUserName:YourPassword@YourHost:5432/YourDatabase";





                      share|improve this answer












                      The following worked for me



                      var conString = "postgres://YourUserName:YourPassword@YourHost:5432/YourDatabase";






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Oct 9 '18 at 9:51









                      Hemadri DasariHemadri Dasari

                      7,66911339




                      7,66911339























                          2














                          the connection url for postgres
                          syntax:



                          "Server=host ipaddress;Port=5432;Database=dbname;User Id=userid;Password=password;


                          example:



                          "Server=192.168.1.163;Port=5432;Database=postgres;User Id=postgres;Password=root;





                          share|improve this answer


























                            2














                            the connection url for postgres
                            syntax:



                            "Server=host ipaddress;Port=5432;Database=dbname;User Id=userid;Password=password;


                            example:



                            "Server=192.168.1.163;Port=5432;Database=postgres;User Id=postgres;Password=root;





                            share|improve this answer
























                              2












                              2








                              2






                              the connection url for postgres
                              syntax:



                              "Server=host ipaddress;Port=5432;Database=dbname;User Id=userid;Password=password;


                              example:



                              "Server=192.168.1.163;Port=5432;Database=postgres;User Id=postgres;Password=root;





                              share|improve this answer












                              the connection url for postgres
                              syntax:



                              "Server=host ipaddress;Port=5432;Database=dbname;User Id=userid;Password=password;


                              example:



                              "Server=192.168.1.163;Port=5432;Database=postgres;User Id=postgres;Password=root;






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Dec 1 '16 at 4:17









                              vinoth shankarvinoth shankar

                              19415




                              19415























                                  0














                                  host or hostname would be the i.p address of the remote server, or if you can access it over the network by computer name, that should work to.






                                  share|improve this answer


























                                    0














                                    host or hostname would be the i.p address of the remote server, or if you can access it over the network by computer name, that should work to.






                                    share|improve this answer
























                                      0












                                      0








                                      0






                                      host or hostname would be the i.p address of the remote server, or if you can access it over the network by computer name, that should work to.






                                      share|improve this answer












                                      host or hostname would be the i.p address of the remote server, or if you can access it over the network by computer name, that should work to.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jun 13 '12 at 14:27









                                      user1453137user1453137

                                      391




                                      391






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3582552%2fpostgresql-connection-url%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          What visual should I use to simply compare current year value vs last year in Power BI desktop

                                          How to ignore python UserWarning in pytest?

                                          Alexandru Averescu