Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: A little help connecting to oracle from java. Anyone? Please!!? :-)
thin client not used TNS or ODBC only TCP protocol
DriverManager.registerDriver
(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection ("jdbc:oracle:thin:@" + host + ":1521:" + srv, usr, pwd);
"Simon Harvey" <noThanks_at_pdf.com> сообщил/сообщила в новостях следующее:
news:3d554318_1_at_news.teranews.com...
> Hi,
>
> I'm having problems conecting to an oracle database using jdbc and I was
> wondering if you could help.
>
> The only way I know how to connct to a database (MS Access in particular)
is
> to create a DSN in the Windows control panel applet called Data Sources
> (ODBC) and then use that name as part of the connection string in my java
> program.
>
> But with oracle I'm getting a bit confused as I'm not sure if using this
> method comes into it at all (I hope it does cos it's easy!!) I've read
that
> instead of using the DSN, you just use the service name. Now service names
> scare the crap out of me as I dont understand them.
>
> Well, I've tried both now (I think (not sure if I got the service name
> right)) and each time I'm getting:
>
> java.sql.SQLException: Io exception: Connection
>
refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(
> CODE=12505) (EMFI=4))))
>
>
> I've tried the following two connection strings:
>
> DSN Version:
> String connectionString = "
jdbc:oracle:thin:localhost:1521:daytonDSN";
>
> What I think is the Service Name version:
> String connectionString = "
> jdbc:oracle:thin:localhost:1521:dayton.homenet";
> also tried:
> String connectionString = " jdbc:oracle:thin:localhost:1521:DAYTON";
>
>
> I dont know which is the actual service name as I've been told to
differing
> things. Could someone take a sec just to tell me once and for all!!
Please!
>
> Where the relevant part in my TNS.ora is:
>
> DAYTON = **** Is this the Service Name******
> (DESCRIPTION =
> (ADDRESS_LIST =
> (ADDRESS = (PROTOCOL = TCP)(HOST = aegis)(PORT = 1521))
> )
> (CONNECT_DATA =
> (SERVICE_NAME = dayton.homenet) ******* Or is this the
Service
> Name********
> )
> )
>
>
> You have know idea how much it would mean to me to get this sorted out. I
> was hoping that comething as simple as connecting to the database would be
> easy to do right out of the box but this has had me, my girlfriend and one
> of my best mates bamboozled for weeks.
>
> My (and our) sincerest thanks to anyone who knows what all this means and
> how to fix it. I know its going to be something so trivial but its so
> frustrating!!
>
> Thanks again
>
> Simon
>
>
>
>
>
>
>
>
>
Received on Sat Aug 10 2002 - 21:45:39 CDT
![]() |
![]() |