Unable to connect to oracle database
Hi,
I have created a new test step for jdbc request. I am using oracle.jdbc.driver.OracleDriver for Driver. And the connection string as jdbc:oracle:thin:username/passwd@localhost:1521:sid. All the values I am using in the connection string are being used in the sqldeveloper connections and work just as fine. I had ojdbc7.jar earlier and I was facing the error
"Can't get the Connection for specified properties; java.sql.SQLException: ORA-01017: invalid username/password; logon denied"
I then have downloaded oracle driver ojdbc8.jar and tried, but met with the same error.
I have already copied the jar file to both bin\ext as well as lib folder. Yet the above result.
Can you please suggest a fix
Thanks,
Hi damodharv
The error response you're getting would appear to indicate that the driver files are fine - you'd get a could not initialise connection response if the driver files were incorrect I'd imagine - initialising the connection is done before the authentication is attempted - which is what your error response appears to indicate a problem with.
the .jar driver files are only required in the C:\Program Files\SmartBear\ReadyAPI-2.7.0\bin\ext, not the lib directory
your connection string the host you have is 'localhost' - so you must have Oracle installed on your machine. You say that SQL Developer is using the same parm values - but is it using the tnsnames.ora file for the connection or is it using the oracle jdbc thin driver? I'd double check - cos the connection string should be pretty similar in both ReadyAPI! as SQL Developer.
Have you confirmed the .jar driver file is the correct version relative to your JDK/JRE installed and your JRE is correct relative to your Oracle version? (i.e. check which version of Oracle you are connecting to, google which version of Java is required to connect, then google the driver file version required to talk to the JDK/JRE installed).
I believe the connection string that is required has altered depending on the version of Oracle you are trying to connect to.
If the driver file and Java version is correct to connect to the RDBMS, and the files are in the correct directory (and you haven't got 2 instances of ReadyAPI! installed - i.e. one in Program Files and one in Program Files (x86) directory), then the connection string is likely the issue.
Is your database definitely a single instance (using an SID) rather than a cluster (using a Service Name)? The connection string is different if connecting to Service Name rather than SID - the port number/Service Name separate is a / rather than a :
so instead of
jdbc: oracle:thin:username/passwd@localhost:1521:sid
it was
jdbc: oracle:thin:username/passwd@localhost:1521/service name
You may have to create a new instance of the jdbc thin driver connection string in your Preferences, rather than use the default oracle driver 'OracleThin/oracle.jdbc.driver.OracleDriver'. I've noticed occasionally that ReadyAPI! works when the connection string is slightly different to the one specified and I've had to create a new one (despite the fact there was already one setup by default)
you've specified the connection string your using as follows:
jdbc:oracle:thin:username/passwd@localhost:1521:sid - right?
Its been awhile since I connected to Oracle in SoapUI - but for a MIMER RDBMS connection the string was defined as follows:
jdbc:mimer://<USER>:<PASSWORD>@<HOST>:<PORT:1360>/DB
and so the only way it worked was to include the word 'PORT' adjacent to the relevant port number - e.g. - my connection string for the database was as follows:
jdbc:mimer://RICHARD:PASSWORD01@127.0.0.1:PORT:1360/WHATEVS
I've seen various examples of the Oracle connection string required depending on the Oracle version.
well - the syntax for the connection string is as follows:
jdbc:oracle:thin:<USER>/<PASSWORD>@<HOST:127.0.0.1>:<PORT:1521>:<SID>
jdbc:oracle:thin:<USER>/<PASSWORD>@//<HOST:127.0.0.1>:<PORT:1521>/<SID>
jdbc:oracle:thin:<USER>/<PASSWORD>@//<HOST:127.0.0.1>:<PORT:1521>:<SID>
or you could try rather than the Oracle thin driver, but adding in the rdbthin driver with syntax as follows:
jdbc:rdbThin://servername:port/dbname","username","password"
Apologies - there's a lot of detail above - but what I'm trying to emphasise is that if you've got all your driver versions, java etc. lined up, your .jar files in the correct directory then its likely considering all the problems people have with this (there are lots of posts about this) that it's likely to be the connection string - so you might need to create a new one in your preferences and play with the pattern/format until it works.
This is exactly what I had to do a couple of years ago to get my connection working.
Cheers,
richie