Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JDBC and Relational Databases
The Network Adapter Could not establish the Connection....
Moguluri Ravi Kiran
Ranch Hand
Posts: 63
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please Solve my problem
import java.sql.*; // From java path import javax.sql.*; // From java path import oracle.jdbc.pool.*; // From Oracle path class Test { public static void main(String a[]) { try { OracleDataSource src = new OracleDataSource(); src.setDriverType("thin"); src.setServerName("localhost"); src.setPortNumber(1521); src.setDatabaseName("orcl"); // is this the name of DB we see at the time of installation ? i think something is wrong here... src.setUser("scott"); src.setPassword("tiger"); System.out.println("trying to get Connection"); Connection con=src.getConnection(); System.out.println("Connection Acquired. Creating Statement"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select empno,ename,sal from emp"); while(rs.next()) System.out.println(rs.getString("empno")+ rs.getString("ename")+ rs.getString("sal")); }catch(Exception e){ System.out.println("Error..."+e); } } }
COMPLILATION... trying to get Connection Error...java.sql.SQLException: Io exception: The Network Adapter could not estab lish the connection
Thank you.
Prabhakar Reddy Bokka
Ranch Hand
Posts: 198
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is this what you are trying to do???
http://www.java2s.com/Code/Java/Database-SQL-JDBC/OracleDataSourceDemo.htm
That should work ideally.
Check if your oracle data base is running with the name orcl.
SCJP 5, SCWCD 5
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Oracle Connectivity with thin drivers
Oracle Connectivity with thin drivers !!
oracle Conenctivity using Thin Drivers
Hi,I have a problem in database connection
Classes12.zip Thin Drivers
More...