I have a Dynamic Web Project in Eclipse and is trying to connect through JDBC to Oracle 11g Release 2 Express Edition. But I am getting the error with the following message :
Could not connect to Oracle 11g XE Conn.
Error creating SQL Model Connection connection to Oracle 11g XE Conn. (Error: IO Error: The Network Adapter could not establish the connection)
IO Error: The Network Adapter could not establish the connection
Error creating JDBC Connection connection to Oracle 11g XE Conn. (Error: IO Error: The Network Adapter could not establish the connection)
IO Error: The Network Adapter could not establish the connection
To add, since I am using Apache Tomcat 6.0.35, I have added the Resource and ResourceParams (for the database that I am trying to access) in the server.xml file of \conf.
<Resource name="jdbc/FlightDB" scope="Shareable" type="javax.sql.DataSource"
auth="Container" description="Home Oracle 11g Express Edition"/>
<ResourceParams name="jdbc/FlightDB">
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@server:1521:flightDB</value>
</parameter>
<parameter>
<name>username</name>
<value>system</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
</ResourceParams>
Also, I have added the resource-ref element in web.xml of my current web application.
<resource-ref>
<res-ref-name>jdbc/FlightDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
But it is no help as the problem recurs.
Any help will be greatly appreciated. Look forward to replies.
Thanks,
Somnath
Try following url
jdbc:oracle:thin:@localhost:1521:xe
Last part is SID of server, not database name. Database (or Schema) name is determined by user name during log in. So if your database name is flightDB then there is also user called flightDB. Also check that user has sufficient privileges.