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

Driver supports ADDRESS_LIST description but not DESCRIPTION_LIST #375

Closed
agunglotto opened this issue May 27, 2023 · 3 comments
Closed

Comments

@agunglotto
Copy link

When configuring connections, both following variants are possible and do the same for an Oracle client (and godror):

(DESCRIPTION_LIST=(LOAD_BALANCE=off)(FAILOVER=on)
(DESCRIPTION=(CONNECT_TIMEOUT=5)
(ADDRESS=(PROTOCOL=TCP)(HOST=host_dguard)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=service)(SERVER=DEDICATED))
)
(DESCRIPTION=(CONNECT_TIMEOUT=5)
(ADDRESS=(PROTOCOL=TCP)(HOST=host_active)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=service)(SERVER=DEDICATED))
)
)

(DESCRIPTION=
(ADDRESS_LIST=(LOAD_BALANCE=OFF)(FAILOVER=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=host_dguard)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=host_active)(PORT=1521))
)
(CONNECT_DATA=(SERVICE_NAME=service)(SERVER=DEDICATED))
)

While ADDRESS_LIST works, I get an error for DESCRIPTION_LIST:
ORA-12564: TNS connection refused

@sijms
Copy link
Owner

sijms commented Jun 18, 2023

I make a test file for connect_option

package network

import "testing"

func TestExtractServers(t *testing.T) {
	text := `(DESCRIPTION=
(ADDRESS_LIST=(LOAD_BALANCE=OFF)(FAILOVER=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=host_dguard)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=host_active)(PORT=1521))
)
(CONNECT_DATA=(SERVICE_NAME=service)(SERVER=DEDICATED))
)`
	t.Log(extractServers(text))
	text = `(DESCRIPTION_LIST=(LOAD_BALANCE=off)(FAILOVER=on)
(DESCRIPTION=(CONNECT_TIMEOUT=5)
(ADDRESS=(PROTOCOL=TCP)(HOST=host_dguard)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=service)(SERVER=DEDICATED))
)
(DESCRIPTION=(CONNECT_TIMEOUT=5)
(ADDRESS=(PROTOCOL=TCP)(HOST=host_active)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=service)(SERVER=DEDICATED))
)
)`
	t.Log(extractServers(text))
}

the output

=== RUN   TestExtractServers
    connect_option_test.go:13: [{tcp host_dguard 1521} {tcp host_active 1521}] <nil>
    connect_option_test.go:24: [{TCP host_dguard 1521} {TCP host_active 1521}] <nil>
--- PASS: TestExtractServers (0.00s)
PASS

so go-ora extract same information from both text
would you please give me a complete connection string (which produce connection refused) to test other function

@agunglotto
Copy link
Author

Here is an example. The difference is not only in the host names but also in the service names, where the main instance has a servicename and the data guard instance uses servicename_RO (with underscore RO for readonly).

(DESCRIPTION_LIST=(LOAD_BALANCE=off)(FAILOVER=on)
 (DESCRIPTION=(CONNECT_TIMEOUT=5)(ADDRESS=(PROTOCOL=TCP)
  (HOST=dataguard_host)(PORT=1521))
  (CONNECT_DATA=(SERVICE_NAME=SERVICE_RO)(SERVER=DEDICATED)))
 (DESCRIPTION=(CONNECT_TIMEOUT=5)(ADDRESS=(PROTOCOL=TCP)
  (HOST=active_instance)(PORT=1521))
  (CONNECT_DATA=(SERVICE_NAME=SERVICE)(SERVER=DEDICATED))))

@sijms
Copy link
Owner

sijms commented Jul 2, 2023

I add a fix in v2.7.8 that read server information when it is divided into multiple lines
but driver doesn't support multiple services so it will read the first service occurrence which is SERVICE_RO and ignore the others

@sijms sijms closed this as completed Jul 29, 2023
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