Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jdbc url is wrongly parsed #11

Open
fhrzn opened this issue Mar 11, 2023 · 2 comments
Open

jdbc url is wrongly parsed #11

fhrzn opened this issue Mar 11, 2023 · 2 comments

Comments

@fhrzn
Copy link

fhrzn commented Mar 11, 2023

Describe the bug
In the pgjdbc.py there is a logic to parse sqlalchemy generated url to the one expected by jdbc. In the current implementation it causing the java.net.java.net.UnknownHostException error.

To Reproduce
Steps to reproduce the behavior:

  1. Init sqlalchemy engine by putting standard sqlalchemy url or follow the given example
  2. Run the code
  3. See error

Expected behavior
The expected behavior should be connected successfully to the database.

Screenshots
Screenshot 2023-03-12 at 01 38 29

Desktop (please complete the following information):

  • OS: macOS Ventura
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@fhrzn
Copy link
Author

fhrzn commented Mar 11, 2023

For manual workaround just insert url as jdbc expected format.
jdbc:postgresql://example.com:1521/db

Example in sqlalchemy:
engine = create_engine(f'jdbcapi+pgjdbc://{uname}:{pwd}@{host}:{port}/{dbname}')

@borgle
Copy link
Contributor

borgle commented Sep 11, 2023

@henrykp If your "uname" or "pwd" contains special characters, use urllib quote like this:

from urllib.parse import quote
uname=quote("Amy#clusterid")
pwd=quote("secert@123")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants