pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feed[pgjdbc/pgjdbc] issue #2694: the url is invalid
8+ messages / 4 participants
[nested] [flat]
* [pgjdbc/pgjdbc] issue #2694: the url is invalid
@ 2022-12-05 22:21 "ivostoykov (@ivostoykov)" <[email protected]>
0 siblings, 0 replies; 8+ messages in thread
From: ivostoykov (@ivostoykov) @ 2022-12-05 22:21 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
**I'm submitting a potential issue**
<!--- What kind of an issue is this? Put an `x` in all the boxes that apply: -->
- [x] bug report
- [ ] feature request
**Describe the issue**
Trying to connect the free db hosting located on db.bit.io using a SQL IDE client. I've got a connection string error.
**Driver Version?** 42.5.1
**Java Version?** 11.0.11+9-Ubuntu-0ubuntu2.18.04
**OS Version?** Linux Ubuntu 22.04 LTS
**PostgreSQL Version?** 14
**To Reproduce**
Using a connection string URL like postgresql://aaa:[email protected]/aaa/bbb
**aaa/bbb** is the name of the database. At the same time **aaa** is the username as well
**Expected behaviour**
to connect aaa/bbb databse
But got an error "_According to the driver "PostgreSQL", the URL "postgresql://aaa:[email protected]/aaa/bbb" is invalid._"
This text of the error is reported by the Squirrel SQL client I'm using to connect
Tried to set the driver properties individually, bypassing the query string parsing. But the connection still fails.
No problem to connect using **pg** library in NodeJs with the same credentials.
**Logs**
no PostgreSQL logs are available
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #2694: the url is invalid
@ 2022-12-06 15:45 "davecramer (@davecramer)" <[email protected]>
6 siblings, 0 replies; 8+ messages in thread
From: davecramer (@davecramer) @ 2022-12-06 15:45 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
JDBC doesn't use this particular form.
Use ```
jdbc:postgresql:[//host[:port]/][database][?property1=value1[&property2=value2]...]
```
you can specify the user and password in the properties.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #2694: the url is invalid
@ 2022-12-06 18:13 "ivostoykov (@ivostoykov)" <[email protected]>
6 siblings, 0 replies; 8+ messages in thread
From: ivostoykov (@ivostoykov) @ 2022-12-06 18:13 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
Hi @davecramer ,
Thank you for the answer. I believe you missed the point (perhaps I'm wrong).
And as I see it is that the **database name contains a slash in it**
Thank you
PS: It is a pity the case is closed without additional discussion.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #2694: the url is invalid
@ 2022-12-07 02:56 "davecramer (@davecramer)" <[email protected]>
6 siblings, 0 replies; 8+ messages in thread
From: davecramer (@davecramer) @ 2022-12-07 02:56 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
ah, ok, I can take a look tomorrow. Thanks for the extra information
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #2694: the url is invalid
@ 2025-02-20 19:13 "fladi (@fladi)" <[email protected]>
6 siblings, 0 replies; 8+ messages in thread
From: fladi (@fladi) @ 2025-02-20 19:13 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
I was hit by the same issue, our databases follow the convention:
- `vhost-1.example.com/production`
- `vhost-1.example.com/testing`
- `vhost-1.example.com/feature-1234`
- `vhost-2.example.com/production`
- ...
Now someone wants to connect to them via JDBC (42.7.5) and is hit with `Unable to parse URL jdbc:postgresql://db.example.com:5432/vhost-1.example.com/testing`. I tried to use RFC3986 as stated in the documentation but this only resulted in the same error (with `%2F` decoded to "`/`").
JDBC was used within DBeaver.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #2694: the url is invalid
@ 2025-02-20 19:22 "davecramer (@davecramer)" <[email protected]>
6 siblings, 0 replies; 8+ messages in thread
From: davecramer (@davecramer) @ 2025-02-20 19:22 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
I just tried
```
public class TestDBNameWithSlash {
public static void main(String[] args) {
try (Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/abc%2fdef", "test", "test")) {
System.out.println(con.getCatalog());
} catch (SQLException e) {
e.printStackTrace();
}
}
}
```
and it worked fine.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #2694: the url is invalid
@ 2025-02-20 19:34 "fladi (@fladi)" <[email protected]>
6 siblings, 0 replies; 8+ messages in thread
From: fladi (@fladi) @ 2025-02-20 19:34 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
You are right, I created a new Connection in DBeaver using `%2f` and now it worked. For my first attempt I created a connection with `/` in the DB name and only changed it to `%2f` once I saw the remark in the documentation. So it is more of a DBeaver issue that it kept the original DB name somewhere.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #2694: the url is invalid
@ 2025-11-10 04:20 "nsidhaye (@nsidhaye)" <[email protected]>
6 siblings, 0 replies; 8+ messages in thread
From: nsidhaye (@nsidhaye) @ 2025-11-10 04:20 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
I think DB driver automatically encode URL so client do not need to encode it while configuring. May be we can add some parameter like `encode`
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2025-11-10 04:20 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05 22:21 [pgjdbc/pgjdbc] issue #2694: the url is invalid "ivostoykov (@ivostoykov)" <[email protected]>
2022-12-06 15:45 ` "davecramer (@davecramer)" <[email protected]>
2022-12-06 18:13 ` "ivostoykov (@ivostoykov)" <[email protected]>
2022-12-07 02:56 ` "davecramer (@davecramer)" <[email protected]>
2025-02-20 19:13 ` "fladi (@fladi)" <[email protected]>
2025-02-20 19:22 ` "davecramer (@davecramer)" <[email protected]>
2025-02-20 19:34 ` "fladi (@fladi)" <[email protected]>
2025-11-10 04:20 ` "nsidhaye (@nsidhaye)" <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox