Forum Discussion

jonathon's avatar
jonathon
Contributor
5 years ago

JDBC connections string with special chars

I am migrating a project and trying to connect a datasource, the password for this system has a colon in it and I believe this is breaking the url, because a regular alpha password returns an invalid username/password whereas the correct password with the colon generates "invalid oracle url".

 

What is the documented way to fix this?

  • Yeah, I'm not really sure I agree with this. The URL scheme is one thing, I've worked with plenty of Oracle DBs with special chars and multiple systems easily allow connection via a url string that has special chars. For instance my PyCharm connects easily.

     

    It seems the answer is that you need to double quote the password to escape the characters in the datasource manager , as in:

    "mypassword:@"

    rather than mypassword:@

     

    Thanks

     

    Jonathon

  • richie's avatar
    richie
    Community Hero
    Hey jonathon,

    Yep..... : just like @ and / are all reserved characters and have specific meanings in HTTP and should NEVER be used for user/schema and password whatever the RDBMS (Oracle, SQLServer, etc.) in a connection URL.

    With the password like this, you cant use jdbc or jndi so this wont work for ANY tool trying to connect via jdbc or jndi including ReadyAPI!

    This means this isnt a ReadyAPI! issue and even the error message gives you a clue. ReadyAPI! is just passing along the error response provided by your oracle db connection manager.

    If you tell the DBA who's responsible for this database whats happening (i.e. an http reserved character has been used in the connection credentials) and he/she/they will immediately know what the problem is (and probably blame the DBA who set it 20 years ago) and change the password to something that doesnt include a reserved character!

    Cheers,

    Rich
    • jonathon's avatar
      jonathon
      Contributor

      Yeah, I'm not really sure I agree with this. The URL scheme is one thing, I've worked with plenty of Oracle DBs with special chars and multiple systems easily allow connection via a url string that has special chars. For instance my PyCharm connects easily.

       

      It seems the answer is that you need to double quote the password to escape the characters in the datasource manager , as in:

      "mypassword:@"

      rather than mypassword:@

       

      Thanks

       

      Jonathon

      • richie's avatar
        richie
        Community Hero
        Sorry i should of been clear.
        Special chars yes....ive tested plenty of apps with special alpha chars in username/password for a db..e.g. ,£^ etc., but NOT reserved HTTP chars.

        This will never work with reserved http chars because...well...theyre reserved and have specific meanings in a URL which is why theyre reserved.

        If you think back to your previous experience you wont be able to think of a connection string that used reserved http chars.

        Nice one fella,

        Rich