Pradeep Prasath
Pradeep Prasath

Reputation: 71

PostgreSQL JDBC URL with database name containing forward slash

I have a database named sales/pre in postgreSQL. While connecting to this database with JDBC application, the characters after forward slash get omitted, and I get the following error:

FATAL: database "sales" does not exist.

Is there a way to escape the forward slash?

Upvotes: 1

Views: 2864

Answers (1)

samlewis
samlewis

Reputation: 4048

You are using a JDBC URL so you need to url encode your forward slash e.g.

jdbc:postgresql://host:port/sales%2Fpre

Alternatively choose a different database name.

Upvotes: 2

Related Questions