java - Set postgres db on javaproject with travis -


i'm trying put project on travis, can't make simple connection database. i'm using postgres.

here configuration files: travis link: https://travis-ci.org/victorsilent/sb01/jobs/104453066

.travis.yml

# target programming lamguage language: java  # jdk versios support jdk:   - oraclejdk7   - oraclejdk8 addons:   postgresql: "9.4" sudo: required  services:   - postgresql  # run tests, findbugs, pmd , friends using ant, maven or gradle script: ant test  before_script:   - psql -c "create database teste2;" -u postgres   - psql -c "create schema trabalho;" -u postgres   - psql -c "set search_path 'trabalho'" -u postgres 

my test simple test

@test(expected=exception.class) public void testestat() throws exception{     try{         class.forname("org.postgresql.driver").newinstance();          connection connection = drivermanager.getconnection("jdbc:postgresql://localhost:5432/teste2?currentschema=trabalho","postgres","admin");          statement stmt = null;         stmt = connection.createstatement();         string query = "create table meubanco " +             "(id integer not null, " +             " age integer, " +              " primary key ( id ))";           stmt.executeupdate(query);     }catch(exception e) {                 throw new exception(e);     }  } 

but connection rekt always! wrong these codes?

to solve question change schema public, add

- pg_restore -u postgres -d bdvendas bancovendas.backup 

on .travis.yml , after put .backup database on github repository.


Comments