| Author |
Network Adapter Problem
|
Confused
Ranch Hand
Joined: Jan 24, 2006
Posts: 54
|
|
I have installed oracle 8i and trying to connent the database from my java program. I have added class111.zip and classes12.jar in JDk/lib and added into the classpath to load the oracle driver. can you tell me which userid and password i will use to make a connection. Because I am connecting oracle scott/tiger without any Host String. Class.forName("oracle.jdbc.driver.OracleDriver"); con = DriverManager.getConnection("jdbc racle:thin:@127.0.0.1:1521:SID", "userid", "password"); Pls help me..
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
So, does it work or is there a problem? Have you tried it? Does your code compile and run, or do you get a compiler or runtime error? Ask your database administrator what username and password you should use.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Confused
Ranch Hand
Joined: Jan 24, 2006
Posts: 54
|
|
|
yes ... whenever I am trying to run it , it is showing network adapter related error.. actually Im trying it at home... and my database administrator not sure which userid/ password i should use ... I have installed oracle 8i server version. And I havn't created any schema/user..
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
|
Are you sure the database is started and that you have the appropriate Oracle services running? I'm not an Oracle expert but I think you have to have a TNS listener process running. Anyway, it sounds more like a problem that you need to consult somebody who knows how Oracle works for - it's most likely not a Java problem.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24045
|
|
|
Database questions belong in our JDBC forum. Moving...
|
[Jess in Action][AskingGoodQuestions]
|
 |
Chris Hendy
Ranch Hand
Joined: Mar 04, 2006
Posts: 98
|
|
Its a looong time since I installed Oracle8i, but... Out of the box you should have a user SYS password CHANGE_ON_INSTALL, and a user SYSTEM password MANAGER. I seem to recall that when creating the database you are offered the option of installing the SCOTT/TIGER user and schema, but it is a choice not a default (but I may have misremembered this). To help us diagnose your problem: Check that your database and listener are started. See http://www.coderanch.com/t/81066/Oracle-OAS/getting-error-ORA-TNS-no Can you connect to the database using SQL*Plus as SYSTEM/MANAGER ? Can you connect to the database in SQL*Plus as SCOTT/TIGER ? If you can connect as system and not as scott then it is advisable to create a user and schema to own the database tables and code in your application. Issue the command CREATE USER <app_owner> IDENTIFIED BY <password>; GRANT CONNECT TO <app_owner>; Try to connect usin jdbc. If you get an error please post the stack trace here. If there are ORA- or TNS- error number please be sure to include them.
|
 |
Confused
Ranch Hand
Joined: Jan 24, 2006
Posts: 54
|
|
Thnaks a lot Hendy. I have attempted to login using user id SYS password CHANGE_ON_INSTALL but i failed but didn't try it with user SYSTEM password MANAGER.. Refer to that I can login SQL*Plus by using scott/tiger without any host string... manually . but when i want to conect it from my java API that time how will i use scott / tiger and if i use scott/tiger the what will be my SID. At the time of installing I have given orcl as my global database name. I have seen the TNSNAMES.ora. Do I need to change anything there. and I will defintely try to create user ... and let you know in the evening..b�oz right now Im office.
|
 |
Chris Hendy
Ranch Hand
Joined: Mar 04, 2006
Posts: 98
|
|
I think that to establish a connection to your orcl database as scott/tiger you need the following: con = DriverManager.getConnection("jdbc racle:thin:@127.0.0.1:1521 rcl", "scott", "tiger"); I believe that since you are explicitly giving the host IP, port number and Oracle SID you are bypassing the TNSNAMES.ORA file so don't worry about it. If you are going to be your own DBA you really need the Oracle Documentation set. For 8i you can download it from http://download.oracle.com/docs/cds/A87860_01.zip To administer the database you need the Oracle8i Administrator's Guide For JDBC you need Oracle8i JDBC Developer's Guide and Reference
|
 |
Confused
Ranch Hand
Joined: Jan 24, 2006
Posts: 54
|
|
thanks Hendy! I have tried with this con = DriverManager.getConnection("jdbc racle:thin:@127.0.0.1:1521 rcl", "scott", "tiger"); but still it is showing Network adapter is not connected.. Ok I will remove everything that do it once again.. and let you know.. Tell me one thing , like the way I make DSN to connect with Ms Access. Can't I use same step to connect oracle.. then which driver I should choose from the driver list.
|
 |
Chris Hendy
Ranch Hand
Joined: Mar 04, 2006
Posts: 98
|
|
Right, this is getting challenging. I have a few suggestions, try each one in isolation so if successful we know the real cure. 1) I think class111.zip is oracle7/Java 1.1 vintage, and classes12.jar is Oracle8i/Java 1.2 . I am only guessing but there may be a conflict, see what happens if you remove class111.zip. If that doesn't fix things put it back. 2) Let's be absolutely sure of your Oracle SID. In SQL*Plus run the following query: select instance_name from v$instance; That should be the SID. 3) Instead of con = DriverManager.getConnection("jdbc racle:thin:@127.0.0.1:1521 rcl", "scott", "tiger"); use con = DriverManager.getConnection("jdbc racle:thin:@localhost:1521 rcl", "scott", "tiger"); 4) Check the hostname and port the listener is listening on. At the command line of the DB server issue the command lsnrctl status Check the hostname and port returned, it will look like Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myPC)(PORT=1521))) If all that fails, please copy and paste the stacktrace returned. Concerning an Oracle equivalent of DSN connection to MsAccess. I am not aware of one, but my knowledge is more slanted towards the Oracle side so a more experienced JDBC developer may give you a better answer.
|
 |
Confused
Ranch Hand
Joined: Jan 24, 2006
Posts: 54
|
|
As per your suggetion I have checked the SID name it is showing ORCL my TNSNAMES.ora file in ADmin looks like this _____________________________ Beq-local.world = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = BEQ) (PROGRAM = oracle80) (ARGV0 = oracle80ORCL) (ARGS = '(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))') ) ) (CONNECT_DATA = (SID = ORCL) ) ) Tcp-loopback.world = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 127.0.0.1) (Port = 1521) ) ) (CONNECT_DATA = (SID = ORCL) ) ) _________________________ FROM Services i have seen following services are running OracleAgent80 OracleClentCache80 OracleConTextService80 OracleDatagatherer OracleExtprocAgent OracleNamesService80 OracleServiceORCL OracleStartORCL OracleTNSLitener80 OracleWebAssistant .... Changed the classes111.zip also... still it is showing java.sql.SQLException: Io exception: The Network Adapter could not establish the connection code is like this ---------------------------- Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc racle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))","PIYALI","PIYALI") ; -------------------------------------- what to do next ? can't undertand
|
 |
 |
|
|
subject: Network Adapter Problem
|
|
|