LINKS/ ORACLE

˺¤ì¤Ã¤Ý¤¤¥¨¥ó¥¸¥Ë¥¢¤Î¥ª¥é¥¯¥ëSQL¥ê¥Õ¥¡¥ì¥ó¥¹
http://oracle.se-free.com/
¥ª¥é¥¯¥ë ¤Á¤ç¤³¤Ã¤È¥ê¥Õ¥¡¥ì¥ó¥¹
http://luna.gonna.jp/oracle/index.html
Ocacle Database SQL¥ê¥Õ¥¡¥ì¥ó¥¹ 10g¥ê¥ê¡¼¥¹2(10.2)
http://otndnld.oracle.co.jp/document/products/oracle10g/102/doc_cd/server.102/B19201-02/toc.html

DB TYPES

Java¥Ç¡¼¥¿·¿JDBC¥Ç¡¼¥¿·¿Oracle8iSQL¥Ç¡¼¥¿·¿
StringCHARCHAR
StringVARCHARVARCHAR2
StringLONGVARCHARLONG
java.math.BigDecimalNUMERICNUMBER
java.math.BigDecimalDECIMALNUMBER
booleanBITNUMBER
byteTINYINTNUMBER
shortSMALLINTNUMBER
intINTEGERNUMBER
longBIGINTNUMBER
floatREALNUMBER
doubleFLOATNUMBER
doubleDOUBLENUMBER
byte[]BINARYRAW
byte[]VARBINARYRAW
byte[]LONGVARBINARYLONGRAW
java.sql.DateDATEDATE
java.sql.TimeTIMEDATE
javal.sql.TimestampTIMESTAMPDATE


ref:
http://www.atmarkit.co.jp/fjava/rensai/jdbc02/jdbc02.html

TNS

¡½tnsname.ora¡½
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)

orcl_hoge =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = yyy.yyy.yyy)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL1)
)
)

orcl_piyo = (DESCRIPTION=(ENABLE=BROKEN)(ADDRESS=(PROTOCOL=TCP)(HOST=yyy.yyy.yyy.yyy)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=zzz.zzz.zzz.zzz)(PORT=1521))(FAILOVER=ON)(LOAD_BALANCE=OFF)(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)))

¡½/tnsname.ora¡½

¡½cmd¡½
C:> sqlplus user/password@orcl
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
¤ËÀܳ¤µ¤ì¤Þ¤·¤¿¡£
SQL>exit
C:> sqlplus hoge/hoge@orcl_hoge
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
¤ËÀܳ¤µ¤ì¤Þ¤·¤¿¡£
SQL>exit
¡½/cmd¡½

¡½eclipse,ws¡½
jdbc:oracle:thin:@yyy.yyy.yyy.yyy:1521:orcl1
¡½/eclipse,ws¡½

sqlplus¤«¤é¤Ï¡¢orcl¡¢orcl_hoge¡¢orcl_piyo¤Ç¡¢
eclipse¤äws¤Ç¤Ï¡¢SERVICE_NAME¤ÎÊý¤ò»ØÄꤹ¤ë¡£

dblock

¢£³Ú´Ñ¥í¥Ã¥¯
¥Ç¡¼¥¿¹¹¿·»þ¤Ë¡¢ÂоݤΥǡ¼¥¿¤¬¤¹¤Ç¤Ë¹¹¿·¤µ¤ì¤Æ¤¤¤Ê¤¤¤«³Îǧ¤¹¤ëÊý¼°¡£
¥Æ¡¼¥Ö¥ë¤Ë¤â¤¿¤»¤Æ¤¤¤ë¹¹¿·¥¿¥¤¥à¥¹¥¿¥ó¥×¤ä¡¢¹¹¿·¥Õ¥é¥°¤òÈæ³Ó¤·¤Æ¥í¥Ã¥¯¡£
¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤Ø¤Î±Æ¶Á¤Ï¾¯¡£
¢¨¥¿¥¤¥ß¥ó¥°¤Ë¤è¤Ã¤Æ¡¢ÇÓ¾À©¸æ¤¬¤«¤«¤é¤Ê¤¤¥±¡¼¥¹Í­¡£

ex
¡¡¹¹¿·¤·¤¿¤¤¥ì¥³¡¼¥É¼èÆÀ¡Ü¥¿¥¤¥à¥¹¥¿¥ó¥×¤òÊÝ»ý
¡¡¹¹¿·¤¹¤ëľÁ°¤ÇºÆÅ٥쥳¡¼¥É¼èÆÀ¡Ü¥¿¥¤¥à¥¹¥¿¥ó¥×¤òÊÝ»ý
¡¡£²¤Ä¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×ÃͤòÈæ³Ó
¡¡¤Ç¥í¥Ã¥¯
¡¡
¡ý¥á¥ê¥Ã¥È
¡¡¡¦¥Ç¥Ã¥É¥í¥Ã¥¯¤òµ¤¤Ë¤·¤Ê¤¯¤ÆÎɤ¤¡£

¡ß¥Ç¥á¥ê¥Ã¥È
¡¡¡¦¥Æ¡¼¥Ö¥ë¤Ë¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò»ý¤ÄɬÍפ¬¤¢¤ë¡£

¢£Èá´Ñ¥í¥Ã¥¯
ÊÌ̾¡§ÇÓ¾¥í¥Ã¥¯¤Ë¤Ï¡¢¶¦Í­¥í¥Ã¥¯¡¢ÀêÍ­¥í¥Ã¥¯
¹Ô¤äɽñ°Ì¤Ç¥í¥Ã¥¯¤ò¤«¤±¤ëÊý¼°¡£
¹¹¿·»þ¤Ë¤Ï¡¢ÀêÍ­¥í¥Ã¥¯¡£
¢¨NOWAIT¡Êfor update¡Ë¤ò»ØÄê¤Ç¡¢¥í¥Ã¥¯Ãæ¤Î¥Ç¡¼¥¿¤Ø¥¢¥¯¥»¥¹¤·¤¿¾ì¹ç¤Ë¥¨¥é¡¼¤¬Ê֤롣

ex
¡¡¹¹¿·¤¹¤ë¥ì¥³¡¼¥É¤ËÀêÍ­¥í¥Ã¥¯
¡¡Æ±»þ¤Ë¡¢Â¾¤Î¥æ¡¼¥¶¤Î¹¹¿·¤ÏʪÍýŪ¤ËÀ©¸æ
¡¡
¡ý¥á¥ê¥Ã¥È
¡¡¡¦¥×¥í¥°¥é¥à¤Çµ¤¤Ë¤·¤Ê¤¯¤ÆÎɤ¤¡£

¡ß¥Ç¥á¥ê¥Ã¥È
¡¡¡¦¥Ç¥Ã¥É¥í¥Ã¥¯¤Î¿´ÇÛ¤¢¤ê¡£
¡¡¡¦¥í¥Ã¥¯¤Î´Ö¡¢¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ò°Ý»ý¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£

ref:
http://monjyu.biz/monjyu/bd2/oracle1/msg/105.htmlhttp://monjyu.biz/monjyu/bd2/oracle1/msg/105.html

·¿

¢£´ðËܥǡ¼¥¿·¿
SQL Server ·¿JDBC ·¿ (java.sql.Types)Java ¸À¸ì·¿

bigint

BIGINT

long

timestamp

binary

BINARY

byte[]

bit

BIT

boolean

char

nchar

CHAR

String

decimal

money

smallmoney

DECIMAL

java.math.BigDecimal

float

DOUBLE

double

int

INTEGER

int

image

LONGVARBINARY

byte[]

text

ntext

LONGVARCHAR

String

numeric

NUMERIC

java.math.BigDecimal

real

REAL

float

smallint

tinyint

SMALLINT

short

datetime

smalldatetime

TIMESTAMP

java.sql.Timestamp

varbinary

VARBINARY

byte[]

varchar

nvarchar

VARCHAR

String

uniqueidentifier

CHAR

String



¢£¹âÅ٤ʥǡ¼¥¿·¿
SQL Server ·¿JDBC ·¿ (java.sql.Types)Java ¸À¸ì·¿

varbinary(max)

image

LONGVARBINARY

byte[] (´ûÄê)¡¢Blob¡¢CharacterStream¡¢BinaryStream¡¢String

text

ntext

varchar(max)

nvarchar(max)

LONGVARCHAR

String (´ûÄê)¡¢Clob¡¢CharacterStream¡¢BinaryStream

xml

LONGVARCHAR

String (´ûÄê)¡¢CharacterStream¡¢Clob¡¢byte[]¡¢BinaryStream¡¢Blob

udt

VARBINARY (ºÇÂ祵¥¤¥º¤Ï 8000 ¥Ð¥¤¥È)

String (´ûÄê)¡¢byte[]¡¢BinaryStream¡¢Object



SqlServer.image = Oracle.Blob
BLOB = Binary Large Object = Â礭¤¤¥Ð¥¤¥Ê¥ê¥Ç¡¼¥¿

ref:
msdn
http://msdn2.microsoft.com/ja-jp/library/ms378878.aspx
http://msdn2.microsoft.com/ja-jp/library/ms378813.aspx
seshop.com
http://www.shoeisha.com/mag/windev/pdf/870511/windev0511_162_SQLServer.pdf

PostgreSQLǧ¾Ú¥Õ¥¡¥¤¥ë

set pg_hba.conf

PostgreSQL¥µ¡¼¥Ð¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤ÏƱ°ì¥Û¥¹¥È(localhost)¤«¤é¤Î¥¢¥¯¥»¥¹¤·¤«µö²Ä¤·¤Æ¤¤¤Ê¤¤¡£
Web¥µ¡¼¥Ð¤âƱ¤¸¥Û¥¹¥È¾å¤Çưºî¤·¤Æ¤¤¤ì¤Ð¡¢
¥¯¥é¥¤¥¢¥ó¥È(¥Ö¥é¥¦¥¶)¤Î¥Û¥¹¥È¤Ï LANÆâ¤Ç¤â¥¤¥ó¥¿¡¼¥Í¥Ã¥È¾å¤Ç¤â¤É¤³¤«¤é¤Ç¤¢¤Ã¤Æ¤â¡¢
ľÀÜ¥¢¥¯¥»¥¹¤¹¤ë¤Î¤ÏƱ°ì¥Û¥¹¥È¤Î Web¥µ¡¼¥Ð¤Ê¤Î¤ÇÌäÂê¤Ï¤Ê¤¤¡£
¤·¤«¤·¡¢
Web¥µ¡¼¥Ð¤¬ 192.168.0.2, PostgreSQL¤¬ 192.168.0.3¤Î¤è¤¦¤Ë°Û¤Ê¤ë¥Û¥¹¥È¤Î¤È¤­¤Ï¡¢ÀßÄêÊѹ¹¡£

¤Þ¤º¡¢CGI¥¹¥¯¥ê¥×¥È¤Ç¤Ï¡¢¾åµ­¤Î pg.cgi¤ä pg.php ¤ÎÎã¤Ç¤Ï $host = "localhost"; ¤Ç¤Ï¤Ê¤¯¡¢$host = "192.168.0.3"; ¤Î¤è¤¦¤Ë PostgreSQL¥µ¡¼¥Ð¤ÎIP¥¢¥É¥ì¥¹¤Þ¤¿¤Ï¥Û¥¹¥È̾¤òµ­Æþ¤¹¤ë¡£

PostgreSQL¦¤Ç¤Ï¡¢data¥Õ¥©¥ë¥À¤Î²¼¤Î pg_hba.conf ¥Õ¥¡¥¤¥ë¤Ë°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÄɲä·¡¢PostgreSQL¤òºÆµ¯Æ°¤¹¤ë¡£
¤¿¤À¤·¡¢psql ¤Ê¤É¤«¤é¥¢¥¯¥»¥¹¤·¤Æ
--------------------
psql: fe_sendauth: authentication type 5 not supported
--------------------
¤Î¤è¤¦¤Ê¥¨¥é¡¼¤¬½Ð¤ë¤È¤­¤Ï¡¢md5 -> trust ¤ËÊѹ¹¤¹¤ë¡£
--------------------
start menu > all programs > PostgreSQL 8.2 > ¹½À®¥Õ¥¡¥¤¥ë > pg_hba.conf¤ÎÊÔ½¸
--------------------
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.0.3/32 trust
--------------------
¤³¤ÎÎã¤Ï 192.168.0.3 ¤«¤é¤Î¥¢¥¯¥»¥¹¤Î¤ß¤òµö²Ä¤¹¤ë¤è¤¦¤ËÄɲä·¤¿¾ì¹ç¤Ç¤¢¤ë¡£
¤â¤· 192.168.0.* ¤«¤éµö²Ä¤¹¤ë¤Ê¤é¡¢192.168.0.3/32 ¤Ç¤Ï¤Ê¤¯ 192.168.0.0/24 ¤È¤¹¤ë¡£
¤Þ¤¿ 192.168.*.* ¤«¤éµö²Ä¤¹¤ë¤Ê¤é¡¢192.168.0.0/16 ¤È¤¹¤ë¡£

¼¡¤Ë¡¢data¥Õ¥©¥ë¥À²¼¤Î postgresql.conf¥Õ¥¡¥¤¥ë¤Î listen_addresses¹Ô¤ò°Ê²¼¤Î¤è¤¦¤Ë localhost -> * ¤ËÊѹ¹¤¹¤ë(Êѹ¹¸å¤Ï PostgreSQL¤òºÆµ¯Æ°)¡£
--------------------
# - Connection Settings -
listen_addresses = 'localhost' -> '*'
--------------------
Excel¤Ê¤É¤«¤é PostgreSQL¥µ¡¼¥Ð¤Ë ODBCÀܳ¤¹¤ë¾ì¹ç¤Ë¤â¡¢Æ±°ì¥Û¥¹¥È¤«¤é¤Ç¤Ê¤±¤ì¤Ð¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥¢¥¯¥»¥¹¤Ç¤­¤Ê¤¤¤Î¤Ç¾åµ­¤Î pg_hba.conf, postgresql.conf ¥Õ¥¡¥¤¥ë¤ËÄɲ乤롣

PostgreSQL¤¬Æ°ºî¤·¤Æ¤¤¤ë¥µ¡¼¥Ðµ¡¤Ç¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë¥½¥Õ¥È¤¬Æ°ºî¤·¤Æ¤¤¤ë¤È¤­¤Ï¡¢¥Ý¡¼¥È5432ÈÖ¤ò³«Êü¤¹¤ë¤³¤È¡£


ref:
PostgreSQL¤Î¥¤¥ó¥¹¥È¡¼¥ë/ưºî³Îǧ¼ê½ç Chap.6 ¾¤Î¥Û¥¹¥È¤«¤é¤Î¥¢¥¯¥»¥¹
http://homepage1.nifty.com/yito/anhttpd/faq/postgresql.html
PostgresSQL¤Î¥»¥­¥å¥ê¥Æ¥£
http://www.hizlab.net/app/pgsec.html

ctgr:
postgres

operations for postgreSQL

¢£¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶¤ÎÅÐÏ¿

PostgreSQL¤Ç¤Ï¡¢OS¤Î¥æ¡¼¥¶¤È¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶¤È¤ÏÆÈΩ¤·¤Æ¤¤¤ë¤Î¤Ç¡¢
¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò°·¤¦¤Ë¤Ï¡¢PostgreSQL¤Ë¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶¤òÅÐÏ¿¤¹¤ëɬÍפ¬¤¢¤ë¡£

¿·¤·¤¤¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶¤òÅÐÏ¿¤¹¤ë¤Ë¤Ï¡¢postgres¥æ¡¼¥¶¤Çcreateuser¥³¥Þ¥ó¥É¤ò¼Â¹Ô¡£
createuser¥³¥Þ¥ó¥É¤Ï¡¢postmaster¤¬Æ°¤¤¤Æ¤¤¤ë¾õÂ֤Ǥʤ¤¤Èưºî¤·¤Ê¤¤¡£

Äɲ乤ë¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶Ì¾¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹ºîÀ®µö²Ä¡¢¥æ¡¼¥¶Äɲõö²Ä¤òʹ¤¤¤Æ¤¯¤ë¤Î¤Ç¡¢½ç¼¡¤Ë²òÅú¡£

$ /usr/local/pgsql/bin/createuser -P
Enter name of user to add: hori
Enter password for user "hori": ¥Ñ¥¹¥ï¡¼¥É
Enter it again: ¾å¤ÇÆþÎϤ·¤¿¥Ñ¥¹¥ï¡¼¥É
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER

¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶ hori¤òÄɲä·¡¢¤³¤Î¥æ¡¼¥¶¤¬¿·¤·¤¤¥Ç¡¼¥¿¥Ù¡¼¥¹¤òºîÀ®¤Ç¤­¤ë¤è¤¦¤Ë¤·¤¿¡£
DB¥æ¡¼¥¶¤Î°ìÍ÷

¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶¤Î°ìÍ÷¤Ï¡¢psql¤Ç¥³¥ó¥½¡¼¥ë¤ËÆþ¤Ã¤Æ¡¢

=> \du
List of database users
User name | User ID | Attributes
-----------+---------+----------------------------
hori | 100 | create database
olap | 101 | create database
postgres | 1 | superuser, create database
(3 rows)

¢£¥Ñ¥¹¥ï¡¼¥É¤ÎÀßÄê¤È¥µ¡¼¥Ð¤ÎºÆµ¯Æ°

½é´ü¾õÂ֤Ǥϡ¢postgres¥æ¡¼¥¶¤Ë¥Ñ¥¹¥ï¡¼¥É¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
­¡¥µ¡¼¥Ð¡¼¤òµ¯Æ°¤·¤Æ¡¢¸å½Ò¤ÎÊýË¡¤Ç¡¢postgres¥æ¡¼¥¶¤Ë¥Ñ¥¹¥ï¡¼¥É¤òÀßÄê¡£
­¢¤³¤ì¤â¸å½Ò¤ÎÊýË¡¤Ç¥µ¡¼¥Ð¡¼¤òÄä»ß¤·¡¢ÀßÄê¥Õ¥¡¥¤¥ë¤ò½¤Àµ¤·¤Æ¡¢¥Ñ¥¹¥ï¡¼¥É¤ò»È¤¦¤è¤¦¤Ë¤¹¤ë¡£
TODO: pg_ctl reload¤«¡¢kill -HUP¤Ç¡¢ºÆÆÉ¤ß¹þ¤ß¤µ¤ì¤ë¡£

PostgreSQL¤Îǧ¾Ú¤Ï¡¢$(PGDATA)/pg_hba.conf¥Õ¥¡¥¤¥ë¤¬´ÉÍý¡£
pg_hba.conf¥Õ¥¡¥¤¥ë¤Ï¡¢initdb¥³¥Þ¥ó¥É¤¬¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¡£ ¡¡
$(PGDATA)/pg_hba.conf¥Õ¥¡¥¤¥ë¤Ëǧ¾ÚÊýË¡¤¬½ñ¤«¤ì¤Æ¤¤¤ë¡£¤³¤ì¤ò½¤Àµ¡£

¡Ötrust¡×¤Ï¡¢¥Ñ¥¹¥ï¡¼¥É¥Á¥§¥Ã¥¯¤Ê¤·¤Ë¥µ¡¼¥Ð¡¼¤Ø¤ÎÀܳ¤òµö²Ä¤¹¤ë¡£
trust¤òmd5¤ËÊѹ¹¡£

local all all md5
host all all 127.0.0.1 255.255.255.255 ¡Úmd5¡Û

¤³¤Î¾õÂ֤ǥµ¡¼¥Ð¡¼¤ò³«»Ï¤¹¤ë¤È¡¢¥Ñ¥¹¥ï¡¼¥É¤¬Í׵ᤵ¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
¤·¤«¤·¡¢¤³¤ì¤À¤±¤Ç¤Ï¡¢¥µ¡¼¥Ð¡¼¤ØÀܳ¤·¤¿¥æ¡¼¥¶¡¼¤Ï¡¢¤¹¤Ù¤Æ¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤ë¡£

ǧ¾ÚÊý¼°¤¬ident¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤È¡¢¥Ñ¥¹¥ï¡¼¥Éǧ¾Ú¤µ¤ì¤Ê¤¤¡£
¥Ñ¥¹¥ï¡¼¥É¤Ï¡¢password, md5, crypt¤Î¤È¤­¤Î¤ßÍ­¸ú¡£
ident¤Î¤È¤­¤Ï¡¢UNIX¥æ¡¼¥¶¡¼¤¬¤½¤Î¤Þ¤ÞPostgreSQL¥æ¡¼¥¶¡¼¤È¤·¤Æ°·¤ï¤ì¤ë¡£
¤·¤¿¤¬¤Ã¤Æ¡¢¼¡¤Î¤è¤¦¤Êµóư¤Ë¤Ê¤ë¡£
$ createuser -U postgres -W postgres' password => ¤³¤ì¤Ï¼ºÇÔ¡£
-U, -W¤Ï̵»ë¤µ¤ì¤Æ¤¤¤ë¡£
postgres¥æ¡¼¥¶¡¼¤Ë¤Ê¤Ã¤Æ¡¢
$ createuser hori => ¤³¤ì¤ÏÀ®¸ù¡£
¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢½êÍ­¼Ô¡Ê¤ª¤è¤Ó¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¡¼¡Ë¤Î¤ß¤¬¤½¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ·¤ÆÊѹ¹¤ò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
¤Ç¤â¡¢Â¾¿Í¤¬¥ª¡¼¥Ê¡¼¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤ËÀܳ¤·¤Æ¡¢¤½¤³¤Çɽ¤òºî¤Ã¤¿¤ê¤Ï¤Ç¤­¤ë¡£
Chapter 6. ¥¯¥é¥¤¥¢¥ó¥Èǧ¾Ú
http://www.postgresql.jp/document/pg734doc/admin/client-authentication.html

¢£¥Ñ¥¹¥ï¡¼¥É¤ÎÊѹ¹

¥Ñ¥¹¥ï¡¼¥É¤òÊѹ¹¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤¹¤ë¡£

# psql -U postgres template1
...
template1=# ALTER USER ¥æ¡¼¥¶Ì¾ WITH PASSWORD '¿·¤·¤¤¥Ñ¥¹¥ï¡¼¥É';
ALTER ROLE

¢£¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶¤Îºï½ü

¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶¤òºï½ü¤¹¤ë¤Ë¤Ï¡¢dropuser¥³¥Þ¥ó¥É¤Ç¤è¤¤¡£
¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î´ÉÍý
¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎºîÀ®
¥Ç¡¼¥¿¥Ù¡¼¥¹¤òºîÀ®¤¹¤ë¤Ë¤Ï¡¢createdb¥³¥Þ¥ó¥É¤ò»ÈÍÑ¡£
¡Êpostmaster¤¬Æ°¤¤¤Æ¤¤¤Ê¤±¤ì¤Ðưºî¤·¤Ê¤¤¡£¡Ë
--------------------
$ cd /usr/local/pgsql/bin
$ ./createdb booksample
CREATE DATABASE
--------------------
¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶¡¼Ì¾¤òÌÀ¼¨Åª¤Ë»ØÄꤹ¤ë¤Ë¤Ï¡¢createdb¥³¥Þ¥ó¥É¤Ë-U¥ª¥×¥·¥ç¥ó¤òÅϤ¹¡£
¾Êά¤¹¤ë¤È¸½ºß¤ÎOS¤Î¥æ¡¼¥¶¡¼Ì¾¤¬»È¤ï¤ì¤ë¡£
¥Ç¡¼¥¿¥Ù¡¼¥¹¤Îʸ»ú¥³¡¼¥É¤ò»ØÄꤹ¤ë¤Ë¤Ï¡¢-E¥ª¥×¥·¥ç¥ó¤Ç»ØÄê¡£
¾Êά¤¹¤ë¤È¡¢ASCII¤È¤Ê¤ë¡£

--------------------
$ ./createdb -E EUC-JP booksample2
CREATE DATABASE
--------------------

¢£¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î°ìÍ÷
¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò°ìÍ÷¤¹¤ë¤Ë¤Ï¡¢psql¥³¥Þ¥ó¥É¤Ë-l¥ª¥×¥·¥ç¥ó¤òÅϤ¹¡£
¼«Ê¬¤¬½êÍ­¼Ô¤Ç¤Ê¤¤¥Ç¡¼¥¿¥Ù¡¼¥¹¤â°ìÍ÷ɽ¼¨¤µ¤ì¤ë¡£
--------------------
$ ./psql -l
List of databases
Name | Owner | Encoding
-------------+----------+-----------
booksample2 | hori | EUC_JP
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(3 rows)
--------------------

¢£¥Ç¡¼¥¿¥Ù¡¼¥¹¤Îºï½ü
¥Ç¡¼¥¿¥Ù¡¼¥¹¤òºï½ü¤¹¤ë¤Ë¤Ï¡¢dropdb¥³¥Þ¥ó¥É¤ò»ÈÍÑ¡£
¥Ç¡¼¥¿¥Ù¡¼¥¹¥æ¡¼¥¶¡¼Ì¾¤òÌÀ¼¨Åª¤Ë»ØÄꤹ¤ë¤Ë¤Ï¡¢createdb¥³¥Þ¥ó¥É¤ÈƱÍͤˡ¢-U¥ª¥×¥·¥ç¥ó¤òÅϤ¹¡£
--------------------
$ ./dropdb booksample
DROP DATABASE
--------------------

ref:
http://www.nslabs.jp/postgresql.rhtml

ctgr:
postgres

¥¯¥é¥¤¥¢¥ó¥ÈÀܳ»þ¤Î¾ã³²

¢¢¥¯¥é¥¤¥¢¥ó¥ÈÀܳ»þ¤Î¾ã³²

=original err msg=================================
Could not create pool connection. The DBMS driver exception was: FATAL: Password authentication failed for user "postgres"
==================================================


Password authentication failed for user 'joeblow'

Password authentication failed for user 'joeblow'
¡Ê¥æ¡¼¥¶Ì¾ joeblow ¤ËÂФ¹¤ë¥Ñ¥¹¥ï¡¼¥Éǧ¾Ú¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡Ë


Messages like this indicate that you contacted the postmaster, and it's willing to talk to you, but not until you pass the authorization method specified in the pg_hba.conf file. Check the password you're providing, or check your Kerberos or IDENT software if the complaint mentions one of those authentication types.
¤³¤Î¥á¥Ã¥»¡¼¥¸¤Ï¡¤postmaster¤È¤Î¥³¥ó¥¿¥¯¥È¤ËÀ®¸ù¤·¡¤¤½¤·¤ÆÁê¼ê¤â ¤¢¤Ê¤¿¤ÈÏäò¤·¤¿¤«¤Ã¤¿¡¥¤Ê¤Î¤Ë¡¤pg_hba.conf¤Ë»ØÄꤵ¤ì¤¿Ç§¾ÚÊýË¡¤Ë¥Ñ¥¹¤¹¤ë¤Þ¤Ç¤ª¤¢¤º¤±¤Ë¤µ¤ì¤¿¤³¤È¤ò¼¨¤¹¡¥¼«Ê¬¤ÇÀßÄꤷ¤¿ ¥Ñ¥¹¥ï¡¼¥É¤ò³Îǧ¤¹¤ë¡¤¤¢¤ë¤¤¤Ï¤â¤·¥¨¥é¡¼¤ÎÆâÍÆ¤¬Kerberos¤«IDENT¤Î ¤É¤Á¤é¤«¤Îǧ¾ÚÊýË¡¤Ë¿¨¤ì¤Æ¤¤¤ë¤Î¤Ê¤é¡¤¤½¤ì¤é¤òÄ´¤Ù¤Æ¤ß¤Æ¡¥

FATAL 1: SetUserId: user 'joeblow' is not in 'pg_shadow'

FATAL 1: SetUserId: user 'joeblow' is not in 'pg_shadow'
¡ÊÃ×̿Ū¤Ê¥¨¥é¡¼ 1: SetUserId: ¥æ¡¼¥¶ 'joeblow' ¤Ï 'pg_shadow' ¤Ë¸ºß¤·¤Þ¤»¤ó¡Ë


This is another variant of authentication failure: no Postgres create_user command has been executed for the given username.
¤³¤ì¤Ïǧ¾Ú¤Î¼ºÇԤ˴ؤ¹¤ëÊ̤Υ±¡¼¥¹¡§Åö³º¥æ¡¼¥¶¤Î¤¿¤á¤Ë¼Â¹Ô¤µ¤ì¤ë¤Ù¤­create_user¥³¥Þ¥ó¥É¤¬¡¤¼Â¹Ô¤µ¤ì¤Æ¤¤¤Ê¤¤¡¥

FATAL 1: Database testdb does not exist in pg_database

FATAL 1: Database testdb does not exist in pg_database
¡ÊÃ×̿Ū¤Ê¥¨¥é¡¼ 1: ¥Ç¡¼¥¿¥Ù¡¼¥¹ testdb ¤Ï pg_database ¤Ë¸ºß¤·¤Þ¤»¤ó¡Ë


There's no database by that name under the control of this postmaster. Note that if you don't specify a database name, it defaults to your Postgres username, which may or may not be the right thing.
³ºÅö¤¹¤ë̾Á°¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤¬¡¤¸½ºß¤Îpostmaster¤ÎÀ©¸æ¤Î¤â¤È¤Ë¤Ê¤¤¡¥¤â¤·¥Ç¡¼¥¿¥Ù¡¼¥¹Ì¾¤ò»ØÄꤷ¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï¡Ê¤½¤ì¤¬Àµ¤·¤¤¤â¤Î¤« ¤½¤¦¤Ç¤Ê¤¤¤Î¤«¤Ë¤Ï¤«¤«¤ï¤é¤º¡ËPostgres¤Î¥æ¡¼¥¶Ì¾¤¬¥Ç¥Õ¥©¥ë¥È¤Ç¥Ç¡¼¥¿ ¥Ù¡¼¥¹Ì¾¤È¤Ê¤ë¤³¤È¤ËÃí°Õ¡¥


==================================================
command for login test:

posgres cmd>
psql postgres -U username -W

it will ask your password for the username.
==================================================


ref:
http://www.postgresql.jp/document/pg653doc/ej/admin/x2498.htm

ctgr:
postgres

postgres references

¡¦PostgresSQL¤ÎÀßÄê
http://homepage2.nifty.com/pcmemo/windows/win10.html
³¨ÉÕ¤­¤Çʬ¤«¤ê°×¤¤¡£

¡¦PostgresSQL¤Î¥¤¥ó¥¹¥È¡¼¥ë
http://www.inf.ie.kanagawa-u.ac.jp/uchida/install/index.html
Îã¤Îver¤¬8.1¡£
´Ä¶­ÊÑ¿ôÀßÄê¤È¥æ¡¼¥¶/DBºî¤ê¤ÎÀâÌÀ¥ö½ê¤Ï»²¾È²ÁÃͤ¢¤ê¡£

¡¦PostgreSQL¤Î´Ä¶­ÀßÄê
http://ash.jp/db/pg_init.htm
psql¤òÍѤ¤¤¿¥·¥ó¥×¥ë¤ÊÎã¡£
ʬ¤«¤ê°×¤¤¤¬¡¢¤â¤¦¾¯¤·¾ðÊó¤¬Íߤ·¤¤¡£

¡¦basic operation of psql
http://www.yc.musashi-tech.ac.jp/~yamada/doc/pgsql/0301.html#database
¥³¥Þ¥ó¥É¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¤Ë¡£

posgre users

postgreshas 3 type users.
¡¦windows system¾å¤ÇÁàºî¤¹¤ë¥æ¡¼¥¶
¡¡¡áwindows systemÆâ¤Î»ñ¸»¤ò´ÉÍý¤Ç¤­¤ë´ÉÍý¼Ô¸¢¸Â¤ò»ý¤Ä¥¤¥ó¥¹¥È¡¼¥ë¥æ¡¼¥¶
¡¡¡¡¢ª¥Þ¥·¥ó¾å¤Î¥ê¥½¡¼¥¹´ÉÍý¤Ê¤É¤ÎÀßÄê
¡¡¡¡¢ª¥µ¡¼¥Ó¥¹¤Î¥Þ¥Í¡¼¥¸¥á¥ó¥È
¡¦³ä¤êÅö¤Æ¤é¤ì¤¿»ñ¸»¤ò»È¤¦¤³¤È¤À¤±¤¬µö¤µ¤ì¤¿µ¯Æ°¥æ¡¼¥¶
¡¡¡¡¢ªpostmaster¤Îµ¯Æ°
¡¡¡¡¢ªDB¥¯¥é¥¹¥¿¤Î´ÉÍý
¡¦¥¯¥é¥¤¥¢¥ó¥È¤È¤·¤ÆÁàºî¤¹¤ë¥æ¡¼¥¶
¡¡¡¡¢ªnetword¤«¤éÀܳÁàºî¤¹¤ë¥æ¡¼¥¶

¢¨¥æ¡¼¥¶¥¢¥«¥¦¥ó¥È¤«¤é¤Ï³ÎǧÉԲġ£
¡¡¢ª´ÉÍý¥Ä¡¼¥ë¤Î¥³¥ó¥Ô¥å¡¼¥¿¤Î´ÉÍý¤ò¹Ô¤¦¡£

ref:
PostgreSQL for Windows
http://www.osri.co.jp/download/osc2006niigata.pdf

Top|Next »

HOME

09 | 2008/10 | 11
Æü ·î ²Ð ¿å ÌÚ ¶â ÅÚ
- - - 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 -

QR

name:
mail:
title:
body:

N/A