I am migrating tables from an old database to a new database (I am using PostgreSQL).
My goal is; Once I export the job, I want to prompt the user to enter the database connection details (host, port, database name, etc..) when he want to execute the Job.
I did like the following but it didn't work;
database connection settings:
Sample job:
input Component Details:
The Following exception is raised :
org.postgresql.util.PSQLException: FATAL: database "context_db.db_name" does not exist
There are 2 problems with your job :
Your need to reference your db_name variable by adding the prefix context
like this : context.db_name
(and not context_db.db_name
).
Because you defined your context group before creating the connection, typing context.db_name
as your database will interpret it as a string literal (and not a context variable), that's why you're you're getting an error as it's looking for a database with the name "context_db.db_name", which doesn't exist. In order to reference an existing context variable, click "Export as context" when you're on the connection window, then select "Reuse an existing repository context" :
Next choose your context group, and map each connection parameter to an existing context variable from the droplist. When you finish, you'll see that your connection is using the context variable context.db_name
as its database name.
In order to prompt the user for a value, you need to activate the checkbox next to the variable (Activate prompt on variable), which you've already done.