/*
-FILE * $Header$
+ * $Header$
*
* Handles PCP connection, and protocol communication with pgpool-II
* These are client APIs. Server program should use APIs in pcp_stream.c
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2016 PgPool Global Development Group
+ * Copyright (c) 2003-2019 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
import java.io.PrintWriter;
+import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
public static void main(String[] args) throws Exception {
ResultSet rs;
Properties props = new Properties();
- props.setProperty("user", "t-ishii");
- props.setProperty("password", "");
- props.setProperty("protocolVersion", "3");
+ props.load(new FileInputStream("javatest.prop"));
+ String url = props.getProperty("jdbc.url");
+ String user = props.getProperty("jdbc.user");
+ String pwd = props.getProperty("jdbc.password");
+
DriverManager.setLogWriter(new PrintWriter(System.out));
- Driver.setLogLevel(2);
- Connection conn = DriverManager.getConnection(
- "jdbc:postgresql://localhost:11000/test", props);
+ Connection conn = DriverManager.getConnection(url, user, pwd);
conn.setAutoCommit(true);
Statement st = conn.createStatement();
st.setFetchSize(100);
# requires Java PostgreSQL JDBC driver.
source $TESTLIBS
+WHOAMI=`whoami`
TESTDIR=testdir
PSQL=$PGBIN/psql
-export CLASSPATH=.:/usr/local/pgsql/share/postgresql-9.2-1003.jdbc4.jar
+export CLASSPATH=.:$JDBC_DRIVER
rm -fr $TESTDIR
mkdir $TESTDIR
export PGPORT=$PGPOOL_PORT
+echo "jdbc.url=jdbc:postgresql://localhost:$PGPOOL_PORT/test" > javatest.prop
+echo "jdbc.user=$WHOAMI" >> javatest.prop
+echo "jdbc.password=" >> javatest.prop
+
+
echo "memory_cache_enabled = on" >> etc/pgpool.conf
sh startall
wait_for_pgpool_startup
-cd ..
+cp ../Sample.java .
$PSQL test <<EOF
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(i int);
EOF
javac Sample.java
java Sample # hang here if the bug bites you...
-cd $TESTDIR
sh shutdownall
exit 0