Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Caught: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

 
Malathy Emm
Greenhorn
Posts: 2
Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am new to both java and groovy,
I have to connect to oracle through using JDBC connectivity in groovy

package com.MyWorks
import groovy.sql.Sql
sql = Sql.newInstance("jdbcracle:thin:@localhost:1521", "username",
"password","oracle.jdbc.driver.OracleDriver")
sql.eachRow("SELECT file_id, record_id FROM Employee ")
{
println "The details are ${it.file_id} ${it.record_id}."
}

Is my code correct. I got Caught: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection error. Can anyone help me on this
 
Malathy Emm
Greenhorn
Posts: 2
Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also i forgot to add that i have supplied my application's username and password.
 
Swastik Dey
Rancher
Posts: 1719
8
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure oracle service and tns listeners are running.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!