PostgreSQL Connection URL












113















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





























    113















    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



























      113












      113








      113


      30






      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,92863270




      8,92863270










      asked Aug 27 '10 at 8:43









      JIIJII

      604279




      604279
























          5 Answers
          5






          active

          oldest

          votes


















          235














          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





















          • 12





            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











          • If you still have problems, check the special characters in your password, change it temporarily for only numbers and test the URL (just to validate that your connection is working as expected)

            – Edenshaw
            Feb 21 at 16:29



















          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































            12














            The following worked for me



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





            share|improve this answer

































              1














              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














                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









                  235














                  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





















                  • 12





                    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











                  • If you still have problems, check the special characters in your password, change it temporarily for only numbers and test the URL (just to validate that your connection is working as expected)

                    – Edenshaw
                    Feb 21 at 16:29
















                  235














                  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





















                  • 12





                    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











                  • If you still have problems, check the special characters in your password, change it temporarily for only numbers and test the URL (just to validate that your connection is working as expected)

                    – Edenshaw
                    Feb 21 at 16:29














                  235












                  235








                  235







                  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

                  28.6k759100




                  28.6k759100










                  answered Dec 21 '13 at 18:37









                  AndreyAndrey

                  2,601197




                  2,601197








                  • 12





                    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











                  • If you still have problems, check the special characters in your password, change it temporarily for only numbers and test the URL (just to validate that your connection is working as expected)

                    – Edenshaw
                    Feb 21 at 16:29














                  • 12





                    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











                  • If you still have problems, check the special characters in your password, change it temporarily for only numbers and test the URL (just to validate that your connection is working as expected)

                    – Edenshaw
                    Feb 21 at 16:29








                  12




                  12





                  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













                  If you still have problems, check the special characters in your password, change it temporarily for only numbers and test the URL (just to validate that your connection is working as expected)

                  – Edenshaw
                  Feb 21 at 16:29





                  If you still have problems, check the special characters in your password, change it temporarily for only numbers and test the URL (just to validate that your connection is working as expected)

                  – Edenshaw
                  Feb 21 at 16:29













                  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

                      177k43325433




                      177k43325433























                          12














                          The following worked for me



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





                          share|improve this answer






























                            12














                            The following worked for me



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





                            share|improve this answer




























                              12












                              12








                              12







                              The following worked for me



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





                              share|improve this answer















                              The following worked for me



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






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Mar 17 at 3:47

























                              answered Oct 9 '18 at 9:51









                              Hemadri DasariHemadri Dasari

                              10.2k32153




                              10.2k32153























                                  1














                                  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




























                                    1














                                    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


























                                      1












                                      1








                                      1







                                      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

                                      21225




                                      21225























                                          -2














                                          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




























                                            -2














                                            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


























                                              -2












                                              -2








                                              -2







                                              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

                                              351




                                              351






























                                                  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.




                                                  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







                                                  這個網誌中的熱門文章

                                                  Academy of Television Arts & Sciences

                                                  L'Équipe

                                                  1995 France bombings