Invalid Oracle URL specified: OracleDataSource.makeURL

后端 未结 3 1206
挽巷
挽巷 2020-12-03 15:11

I\'m trying to connect to a local oracle database but I\'m getting this cryptic error message: Invalid Oracle URL specified: OracleDataSource.makeURL.

相关标签:
3条回答
  • 2020-12-03 15:26

    Surprisingly, after adding the following two lines to the code which created the connection, it worked.

    dataSource.setPortNumber(1521);
    dataSource.setDriverType("thin");
    

    I don't understand why we did not have that problem before, but that may have something to do with my local install. My biggest beef is with the error message not giving any detail about what is wrong though.

    0 讨论(0)
  • 2020-12-03 15:27

    For WildFly users (v14.0.1.Final currently).

    You need to add additional parameters for DataSource:

    DataSource -> Connection -> Connection Properties

    driverType=thin (press Enter to complite).

    Also doublecheck you use right type of DataSource. In my case problem was solved by creating XA DataSource and pass URL to parameter.

    0 讨论(0)
  • 2020-12-03 15:29

    if you use setUrl (or if your container like glassfish does it)

    make sure you use correct syntax

    ==== Notice the colon before @ ====

    jdbc:oracle:thin:@localhost:1521:sid

    or

    jdbc:oracle:thin:@localhost:1521/servicename

    The datasource class tries to parse it and gives cryptic error if syntax has issues

    0 讨论(0)
提交回复
热议问题