I'm traied to connect oracle with Spring and DBCP.
<bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@localhost:1521/ORCL" />
<property name="username" value="PMSYSDB" />
<property name="password" value="********" />
but I get:
Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (IO Error: The Network Adapter could not establish the connection)
I'm able to connect via SQLDeveloper with this properties:
Port : 1521
SID : ORCL
so my database is up and running...
Firewall is off...
The database and the tomcat are on the same machine...
Think it's not important, but i use the datasource with Spring Security:
select username, password, enabled
from users where username=?"
select u.username, ur.authority from users u, user_roles ur
where u.user_id = ur.user_id and u.username =? "
The problem was that I used this syntax
jdbc:oracle:thin:@localhost:1521/ORCL for the connection string. After
/ Oracle expects service name and not SID (ORCL is my SID).
The solution was to change the connection sring to
The db might be setup not to allow these kind of connections. Try this:
telnet localhost 1521
To see if you can connect on that port.