Showing posts with label postgresql. Show all posts
Showing posts with label postgresql. Show all posts

Monday, 29 May 2017

[PostgreSQL] Install PostgreSQL


1.Install Server & Libraries

#> yum -y install postgresql-server postgresql-contrib





2. Initialize database

#> postgresql-setup initdb



3. Edit configuration

#> su - postgres
$> cd data
$> vi pg_hba.conf

TYPE    DATABASE  USER    ADDRESS         METHOD
host    all       all     127.0.0.1/32    md5
host    all       all     192.168.0.0/24  md5
host    all       all     0.0.0.0/0       md5






$> vi postgresql.conf




4. Start server

#> systemctl start postgresql
#> systemctl status postgresql




5. Create DB

#> su - postgres
$> createdb [DB_NAME]




6. Create user and grant privilege

$> psql -s [DB_NAME]
$> create user [USER_NAME] password '[PASSWORD]';
$> GRANT ALL PRIVILEGES ON DATABASE [DB_NAME] TO [USER_NAME];




Thursday, 18 February 2016

[JDBC] PostgreSQL JDBC Driver Properties

PostgreSQL JDBC Driver

Property NameDescriptionReqiredChoicesSample Value
PGDBNAMEDatabase name to connect to; may be specified directly in the JDBC URL.truenull
userUsername to connect to the database as.truebizteco
PGHOSTHostname of the PostgreSQL server; may be specified directly in the JDBC URL.falsenull
PGPORTPort number to connect to the PostgreSQL server on; may be specified directly in the JDBC URL.falsenull
passwordPassword to use when authenticating.falsebtc7btc
protocolVersionForce use of a particular protocol version when connecting; if set, disables protocol version fallback.falsenull
sslControl use of SSL; any nonnull value causes SSL to be required.falsenull
sslfactoryProvide a SSLSocketFactory class when using SSL.falsenull
sslfactoryargArgument forwarded to constructor of SSLSocketFactory class.falsenull
loglevelControl the driver's log verbosity: 0 is off, 1 is INFO, 2 is DEBUG.false
0
1
2
null
allowEncodingChangesAllow the user to change the client_encoding variable.falsenull
logUnclosedConnectionsWhen connections that are not explicitly closed are garbage collected, log the stacktrace from the opening of the connection to trace the leak source.falsenull
prepareThresholdDefault statement prepare threshold (numeric).falsenull
binaryTransferUse binary format for sending and receiving data if possible.falsenull
binaryTransferEnableComma separated list of types to enable binary transfer. Either OID numbers or names.falsenull
binaryTransferDisableComma separated list of types to disable binary transfer. Either OID numbers or names. Overrides values in the driver default set and values set with binaryTransferEnable.falsenull
charSetWhen connecting to a pre-7.3 server, the database encoding to assume is in use.falsenull
compatibleForce compatibility of some features with an older version of the driver.false
7.1
7.2
7.3
7.4
8.0
8.1
8.2
null
loginTimeoutThe login timeout, in seconds; 0 means no timeout beyond the normal TCP connection timout.falsenull
socketTimeoutThe timeout value for socket read operations, in seconds; 0 means no timeout.falsenull
tcpKeepAliveEnable or disable TCP keep-alive probe.falsenull
stringtypeThe type to bind String parameters as (usually 'varchar'; 'unspecified' allows implicit casting to other types)false
varchar
unspecified
null
kerberosServerNameThe Kerberos service name to use when authenticating with GSSAPI. This is equivalent to libpq's PGKRBSRVNAME environment variable.falsenull
jaasApplicationNameSpecifies the name of the JAAS system or application login configuration.falsenull