{"id":6705,"date":"2016-08-04T11:18:01","date_gmt":"2016-08-04T09:18:01","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/hayek\/jochen\/wp\/blog-en\/?p=6705"},"modified":"2021-10-12T12:42:58","modified_gmt":"2021-10-12T10:42:58","slug":"how-to-connect-to-a-postgresql-database-using-jdbc-wo-host","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2016\/08\/04\/how-to-connect-to-a-postgresql-database-using-jdbc-wo-host\/","title":{"rendered":"how to connect to a PostgreSQL database using JDBC w\/o host"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Java_Database_Connectivity\">https:\/\/en.wikipedia.org\/wiki\/Java_Database_Connectivity<\/a><\/li><li><a href=\"http:\/\/jan-lolling.de\">http:\/\/jan-lolling.de<\/a><\/li><li><a href=\"https:\/\/github.com\/jlolling\/sqlrunner\">https:\/\/github.com\/jlolling\/sqlrunner<\/a><\/li><li><a href=\"https:\/\/github.com\/JochenHayek\/sqlrunner\">https:\/\/github.com\/JochenHayek\/sqlrunner<\/a>&nbsp;\u2013 my fork<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I am giving Jan Lolling&#8217;s SQLRunner a try to connect to a local PostgreSQL database. SQLRunner is written in Java, and it uses JDBC to connect to the various databases.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Apparently there are 2 ways to connect to a PostgreSQL database:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>hostname + port + database + \u2026<\/li><li>socket&nbsp;+ database + \u2026<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The 2nd way is not just a variant of the 1st (I got told).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It appears to me, that JDBC for PostgreSQL only supports the first way. Is there a way to get this assumption confirmed?<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/stackoverflow.com\/questions\/25918416\/jdbc-mysql-connection-using-unix-socket\">http:\/\/stackoverflow.com\/questions\/25918416\/jdbc-mysql-connection-using-unix-socket<\/a>&nbsp;:<br>&#8220;Java itself doesn&#8217;t support unix domain sockets, but since you&#8217;re on windows, you can use named pipes, [..]&#8221; (I am not sure, this is true)<\/li><li><a href=\"http:\/\/dev.mysql.com\/doc\/connector-j\/5.1\/en\/connector-j-reference-configuration-properties.html\">http:\/\/dev.mysql.com\/doc\/connector-j\/5.1\/en\/connector-j-reference-configuration-properties.html<\/a>&nbsp;:&nbsp;NamedPipeSocketFactory \u2026<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/en.wikipedia.org\/wiki\/Java_Database_Connectivity http:\/\/jan-lolling.de https:\/\/github.com\/jlolling\/sqlrunner https:\/\/github.com\/JochenHayek\/sqlrunner&nbsp;\u2013 my fork I am giving Jan Lolling&#8217;s SQLRunner a try to connect to a local PostgreSQL database. SQLRunner is written in Java, and it uses JDBC to connect to the various databases. Apparently there are 2 ways to connect to a PostgreSQL database: hostname + port + database + \u2026 socket&nbsp;+ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[278,494],"tags":[1320],"class_list":["post-6705","post","type-post","status-publish","format-standard","hentry","category-jdbc","category-relational-databases","tag-sqlrunner"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-1K9","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/6705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=6705"}],"version-history":[{"count":1,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/6705\/revisions"}],"predecessor-version":[{"id":11900,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/6705\/revisions\/11900"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=6705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=6705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=6705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}