aspose file tools*
The moose likes JDBC and the fly likes can't connect to oracle database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "can Watch "can New topic
Author

can't connect to oracle database

Wilbert Reyes
Greenhorn

Joined: Oct 30, 2007
Posts: 11
hi all,

i try to run an application but i keep receiving this error message....



please tell me what's wrong and/or tell me what to do on this...i'm very new to this so please be nice

thanks in advance!


"Learning without thought is labor lost, thought without learning is perilous."
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It looks like you are not authorised to connect to that database. Check your connection properties: are you specifying a username and passwork and are they valid?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13869
    
  10

You are getting Oracle error 12514.

Maybe this will help: http://ora-12514.ora-code.com/

Try searching on Google for "ora-12514" for more links.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Wilbert Reyes
Greenhorn

Joined: Oct 30, 2007
Posts: 11
Originally posted by Paul Sturrock:
It looks like you are not authorised to connect to that database. Check your connection properties: are you specifying a username and passwork and are they valid?


yes i'm using a username/password and i've tried the same connecting through toad(a third-party application for oracle) and it worked...i have one more question...does connection/proxy properties matter even though you're connecting to a localhost database (the application and the oracle database is on the same pc)
[ November 05, 2007: Message edited by: Wilbert Reyes ]
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
This can also happen if you don't have a listener at the port you're using for your connection string.

1575 is usually the default for TNSNames... 1630 for ONames.
[ November 05, 2007: Message edited by: Paul Campbell ]
Wilbert Reyes
Greenhorn

Joined: Oct 30, 2007
Posts: 11
hi paul,

i've checked the services (btw, i'm using windows xp) and the TNSListener is running...what i understand here that the 1575 and the 1630 are the ports to be used, right?

thanks in advance
[ November 05, 2007: Message edited by: Wilbert Reyes ]
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
Originally posted by Wilbert Reyes:
hi paul,

i've checked the services (btw, i'm using windows xp) and the TNSListener is running...what i understand here that the 1575 and the 1630 are the ports to be used, right?

thanks in advance

[ November 05, 2007: Message edited by: Wilbert Reyes ]


Not necessarily... you should use the one that is configured with your database... this is in your tnsnames.ora file... it is the one toad connected on to your database (it is probably 1521... sorry... I may steered you slightly wrong on the port... our configuration at work is a bit different because we have been using onames for so long).

You should see something like this in it (if pauldb was your database and you substituted localhost for myserver):

pauldb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myserver)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pauldb)
)
)
#

in your jdbc string you would then have a connection string something like this:


jdbcracle:thin:@myserver:1521:pauldb

Another way to get this information is to start a sqlplus session and enter the following command:

lsnrctl start

It will tell you what listeners are running for oracle.

Does that make sense?

And word of warning... I am more useful on the database side of things... my JDBC and java knowledge is still very thin... just like the client connect example. ;)
[ November 05, 2007: Message edited by: Paul Campbell ]
Wilbert Reyes
Greenhorn

Joined: Oct 30, 2007
Posts: 11
Hi Paul,

It seems that after I tried your example in your previous post and looking at my tnsnames.ora file, the configurations have been right all along(the port is 1521).

And about the lsnrctl start thing... I couldn't run the command in sqlplus, it says unknown command...i'm running 9i (I'm sorry if in so new in all of this).

About your warning...I was already thinking looking for help somewhere else, knowing that this IS an oracle error. But mentioning that, I think you could help me more.

Cheers!
[ November 05, 2007: Message edited by: Wilbert Reyes ]
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
can you copy and paste from your tnsnames.ora file the section related to your database... the error is saying that your service_name isn't associating with the listener. you can open it with notepad.

so the problem is a combination of your jdbc connect string and the listener for your database... sqlplus should be started the sqlplus group in your oracle program group (or something like start sql command line). it be nice to have that info but we don't have to necessarily have it to resolve this problem.
[ November 05, 2007: Message edited by: Paul Campbell ]
Wilbert Reyes
Greenhorn

Joined: Oct 30, 2007
Posts: 11
here it is...

ROANDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ROANDB)
)
)

I really don't understand the part about what to do on this listener so please elaborate on this. I appreciate this since my knowledge on oracle is little.

Thanks for the reply!
[ November 05, 2007: Message edited by: Wilbert Reyes ]
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
Originally posted by Wilbert Reyes:
here it is...

ROANDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ROANDB)
)
)

I really don't understand the part about what to do on this listener so please elaborate on this. I appreciate this since my knowledge on oracle is little.

Thanks for the reply!

[ November 05, 2007: Message edited by: Wilbert Reyes ]


This should be your connect string:

jdbcracle:thin:@localhost:1521:ROANDB

Is that what it looks like?

A listener is service that "listens" for users connecting to the data base.
It is an event listener...and in this case the event is a network connection.

If your still getting the error, restart your data base. I can't remember for sure... but it seems like (if my memory is correct) that Toad does a direct connection to the database and doesn't utilize Oracle's sqlnet any more.

If that is the case... the error is just telling you that the service isn't running.
[ November 05, 2007: Message edited by: Paul Campbell ]
Wilbert Reyes
Greenhorn

Joined: Oct 30, 2007
Posts: 11
thanks for the help!

I got the problem solved...it turned out I had the service name wrong in the application's properties(btw,I'm not using an connection string the application connects through a file). But anyway, thanks again for pointing out the tnsnames.ora.

Cheers!
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
I'm glad you found the solution.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't connect to oracle database
 
Similar Threads
Problem to run Oracle9i after installed in Windows2000 professional?
Configuration
Connect to the DB from Oracle forms 6i with existing Oracle 8.1.7.0.0 DB.
oracle thin driver conection error
Getting error like " Listener refused the connection with the following error: ORA-12514, ..."