You can connect to Postgres-XC from Java programs using PostgreSQL JDBC Driver just like PostgreSQL.
It is available from the next link.
http://jdbc.postgresql.org/index.html
Violating following rules will cause some exceptions.
Some of pgjdbc's official test will fail by the Postgres-XC limitations.
We adjusted it for compatibility test on Postgres-XC with JDBC. We describe how you can test using it.
Create user and database for the test. You have other user and database for the test, you can skip this.
$ pgxc_ctl -- Createuser -s -d test $ pgxc_ctl -- Createdb -U test test
$TEST_HOME declares path to test.
$ git clone http://git.code.sf.net/p/postgres-xc/pgjdbc-xc $TEST_HOME/pgjdbc-xc $ cd $TEST_HOME/pgjdbc-xc $ ant testjar
Please replace Coordinator Address to your coordinator's IP address, Coordinator Port to port number your coordinator is listening.
$ cat > build.local.properties <EOF binarytransfer=false forcebinary=false server=_Coordinator Address_ port=_Coordinator Port_ EOF
If you want to use other user and database, append them to your build.local.properties.
$ cat >> build.local.properties