I have a report that it's connection is set to my localhost Postgres. Now I want to change it's connection to my databse server with Java code. I used the code below to do that before loading report in JAVA.FX designer.
Code: Select all
StiJDBCDatabase stiJDBCDatabase = (StiJDBCDatabase) stiReport.getDictionary().getDatabases().get(0);
stiJDBCDatabase.setConnectionString(My Connection String);
stiJDBCDatabase.setUser("username");
stiJDBCDatabase.setPassword("password");
Code: Select all
connectionString=url=jdbc:postgresql://145.154.51.29:5432;database=mydb;user=username;password=password, promptUserNameAndPassword=false,
url=jdbc:postgres://localhost:5432/mydb,
user=username,
password=password,
driver=org.postgresql.Driver,
other={url=jdbc:postgresql://145.154.51.29:5432}
The connection string I used in designer when i first created the report is:
Server=localhost;Port=5432;Userid=postgres;Password=postgres;Database=mydb
I'm using JAVA.FX 2014.3. Thx for your help.