1

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Not all JDBC drivers use URL encoding (and the JDBC standard doesn't actually say anything about it), so it might work for PostgreSQL (I don't know), but that doesn't mean it works for all JDBC drivers.
@MarkRotteveel is correct, I t doesn't encode forward slash, I get same error saying FATAL: database sales%2Fpre does not exist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.