XREA&CORE SUPPORT BOARD  
  

Go Back   XREA&CORE SUPPORT BOARD > 一般カテゴリー > データベース関連フォーラム
登録 FAQ メンバーリスト カレンダー 検索 新着記事 フォーラムを既読にする

Reply
 
スレッドツール スレッドに投票 表示形式
  #1  
Old 2005/11/09, 11:46 PM
れん れん is offline
Registered User
 
Join Date: 2005/11/09
投稿: 4
れん is on a distinguished road
PGSQLへの接続失敗

非常に初歩的な質問を失礼します。
PGSQLを使用しようと思うのですが、根本的なところで、接続ができません。
PGSQLADMINなどはきちんとログインできるんですが。

$sv="localhost";
$dbname="データベース名";
$user="ユーザー名";
$pass="パスワード";

$str="host=$sv dbname=$dbname user=$user password=$pass";
$conn=pg_connect($str) or die("dame");

エラー:
Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host "localhost" and accepting TCP/IP connections on port 5432?

PGSQLADMINでログインできている以上、ユーザー名とパスワードに違いはないと思います。
サーバーがlocalhostじゃないんでしょうか?
s162を使用しています。
$strの内容もprintしたりしてきちんと確認してます。
PHPINFOのコンパイルオプションも念のため確認しましたがPGSQL使用可能になっていました。
もしかして根本的にこのPG_CONNECTの引数の書き方が間違っているのかと思い、PEARのDBクラスを使用してもやってみたのですがやはりできませんでした。
あまりに初歩的ですが考えられる理由がもう思いつかず質問させていただくことにしました。
MySQLはうまくいくんですが…。
もし他に考えられる原因があれば教えていただけないでしょうか?
Reply With Quote
  #2  
Old 2005/11/10, 01:53 PM
webmaster webmaster is offline
Administrator
 
Join Date: 2001/09/28
投稿: 5,925
webmaster is on a distinguished road
サーバー名:localhostは指定しないでください。

TCP/IP接続ではなく、より高速なUNIXソケット経由での接続になります。
__________________
○XREA.COM - Free Web Hosting -
 URL:http://www.xrea.com/
○VALUE-DOMAIN.COM
 URL:https://www.value-domain.com/
お問い合わせ先:https://www.value-domain.com/support.php
Reply With Quote
  #3  
Old 2005/11/11, 12:39 AM
れん れん is offline
Registered User
 
Join Date: 2005/11/09
投稿: 4
れん is on a distinguished road
といいますと…

具体的にはPGSQLへの接続はどのような形で行なうのでしょうか?
ちょっと漠然としていてわからなかったのでもう少し教えていただけないでしょうか?
MYSQLは定番の繋ぎ方でいけますがPGは違うんですね。
Reply With Quote
  #4  
Old 2005/11/11, 11:07 AM
Fuminichi Fuminichi is offline
Registered User
 
Join Date: 2004/08/03
投稿: 54
Fuminichi is on a distinguished road
Quote:
$str="host=$sv dbname=$dbname user=$user password=$pass";
の部分のhost=$svを消して
Code:
$str="dbname=$dbname user=$user password=$pass";
にするだけでいいかと。
__________________
如月 文日(きさらぎ ふみにち)
http://www.fk-square.net/
admin@fk-square.net
Reply With Quote
  #5  
Old 2005/11/11, 04:19 PM
れん れん is offline
Registered User
 
Join Date: 2005/11/09
投稿: 4
れん is on a distinguished road
解決しました!

ありがとうございます、たったこれだけで見事解決しました(汗)
Reply With Quote
Reply


スレッドツール
表示形式 Rate This Thread
Rate This Thread:

投稿ルール
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
フォーラムジャンプ


All times are GMT +9. The time now is 05:32 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.