mickeypearce/oradew-vscode

Oracle wallet authentication compatibility, userless & passwordless

yevon opened this issue · 9 comments

yevon commented

Within sqlplus or sqlcl you can setup userless and passwordless authentication if you have an auto-login wallet in your oracle_home directory. I don't see any way to setup this kind of db connections with oradew. Passwordless login works like this:

  1. Create oracle wallet with mkstore and autologin:

  2. wallet create -wallet "C:\Oracle\oracle_home\network\admin" -pwd "PASSWORD" -auto_login_local

  3. Setup your tnsnames.ora as normal:

TNS_CONNECTION_NAME=
(description=
(address_list=
(address = (protocol = TCP)(host = yourhost)(port = yourport))
)
(connect_data =
(service_name=yourservicename)
)
)

  1. Add an auto login credential to the wallet
    mkstore -wrl "C:\Oracle\oracle_home\network\admin" -createCredential TNS_CONNECTION_NAME USER_NAME PASSWORD

  2. Then you can connect with sqlplus just with this command:
    sqlplus /@TNS_CONNECTION_NAME

Is there a way to allow setup db configs without specifying user and password and just set up multiple connection strings for every environment? Users is mandatory, and I've tried not specifying any password but it asks me for the password when executing import objects from db.

DB config connection looks like this
{
"DEV":{
"connectString":"TNS_CONNECTION_NAME",
"users":[
{
"user": "?????"
, "password":"?????"
, "schemas":["USER_NAME"]
, "askForPassword": false
}
]
}
}

It would be nice having compatibility with config like this, making connectString at user level and user and password not required:

{
"DEV":{
"users":[
{
"connectString":"TNS_CONNECTION_NAME"
, "schemas":["SCHEMA_NAME"]
},
{
"connectString":"TNS_CONNECTION_NAME_2"
, "schemas":["SCHEMA_NAME_2"]
}
]
}
}

I could look into it, but I really haven't found where is the sql or sqlcl command built, any ideas where shoud I look at?

export const runFileAsScript = async (file, env, user = U_AUTO) => {

Take a look here...

yevon commented

It seems that is working ok if you put user "" and password "" and you just execute as script, but if you compile code it tries to reuse the connection from a connection pool that requires environment and user to be non empty. I will need to make some changes, what do you think?

  1. Modify validations and json definition to allow connectString to be optional at users level in dbconfig.json:
    {
    "ENVIRONMENT":{
    "users":[
    {
    "user":"SCHEMA_NAME",
    "connectString":"CONNECT_STRING",
    }
    ]
    }
    }

  2. Make password non mandatory in dbconfig.json, so it stops asking for it if you specify connectString at users level.

  3. When you specify connectString at users level, connect string will be /@connectString

I agree, it is perfectly fine with me.

yevon commented

I've seen that you participated in SQL Tools for oracle driver, but it is now deprecated as of version 0.23 because drivers are now separated extensions. Is there any special reason for it? Did you just not updated it or did you find some limitations?

Mainly I haven't found the time to update it, also It hadn't really suited my needs for fast data browsing that I needed. Maybe you can try version 0.22...

yevon commented

I will give a try to visual studio and official oracle extension as I think that it could solve all my needs. The visual studio code official extension is too basic right now.

please let me know if you find it satisfying.

yevon commented

I've tried it and it was really dissapointing, visual studio code is much faster and the extension for full visual studio has reallly serious bugs and performance issues

I still use SQL Developer for more data-related work (complicated SQLs, optimizactions, etc..), but oradew for PL/SQL development...