Skip to content
This repository has been archived by the owner on Feb 13, 2025. It is now read-only.

DATA_SOURCE_NAME EnvVar unparseable if password contains hash/pound/# symbol #385

Open
1 of 2 tasks
dmitrydonskih opened this issue Nov 21, 2023 · 2 comments
Open
1 of 2 tasks

Comments

@dmitrydonskih
Copy link

I'm submitting a ...

  • bug report
  • feature request

What is the current behavior?

Binary starts and throws an error "invalid port \":XxXxX\" after host" if password in URI string contains # symbol.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

$ export DATA_SOURCE_NAME=oracle://user:PaSs#wOrd@testora:1521/TEST1
$ echo $DATA_SOURCE_NAME
oracle://user:PaSs#wOrd@testora:1521/TEST1
$ /usr/local/bin/oracledb_exporter-0.5.2 --default.metrics "/etc/oracledb_exporter/default-metrics.toml" --log.level debug --web.listen-address 0.0.0.0:9161
ts=2023-11-21T22:36:57.951Z caller=collector.go:327 level=debug launchingconnection:=***@testora:1521/TEST1
ts=2023-11-21T22:36:57.951Z caller=collector.go:333 level=debug setmaxidleconnectionsto=0
ts=2023-11-21T22:36:57.951Z caller=collector.go:335 level=debug setmaxopenconnectionsto=10
ts=2023-11-21T22:36:57.951Z caller=collector.go:337 level=debug successfullyconnectedto:=***@testora:1521/TEST1
ts=2023-11-21T22:36:57.951Z caller=collector.go:262 level=error errorpingingoracle:="parse \"oracle://user:PaSs\": invalid port \":PaSs\" after host"

What is the expected behavior?

Parse URI correctly: port=1521, password=PaSs#wOrd

What is the motivation / use case for changing the behavior?

Fix it

Please tell us about your environment:

Oracle Linux 8.8 5.4.17-2136.324.5.3.el7uek.x86_64
Version: 0.5.1, 0.5.2-rc

@ToMMy86
Copy link

ToMMy86 commented Nov 22, 2023

Same problem ... i have problem with "#" in username as i'm connecting with a CDB User C## ...

@blast-o
Copy link

blast-o commented Jan 9, 2024

The value is directly passed down to url.Parse (and treated as a URL).

Replacing "#" with its url encoded equivalent should fix the problem (i.e replace the # in your connection string with %23)

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

No branches or pull requests

3 participants