java.sql.SQLException: ORA-01009: missing mandatory parameter

don't understand why I am getting this error........

the method is

try{

url="jdbc:oracle:thin:@//172.21.1.2:1521/orcl";

user="XXXXX";

password="#####";

OracleDataSource ods =new OracleDataSource();

ods.setURL(url);

ods.setUser(user);

ods.setPassword(password);

connect = ods.getConnection();

}catch (Exception e){

System.out.print(e);

}

I have also tried this method for url

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.21.1.2)=(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCL)(SERVER=DEDICATED)))

but then it gives me this error

java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=168821248)(ERR=12504)(ERROR_STACK=(ERROR=(CODE=12504)(EMFI=4))))

other application(about which I don't know how they are connectinng) are able to connect with service name "ORCL" then why not me.

please let me know if you found some solution....

[1289 byte] By [hunterzza] at [2007-11-27 8:26:34]
# 1
Are you sure the connection url is correct: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/j2ee/jdbc/JDBC_in_J2EE.html
tolmanka at 2007-7-12 20:16:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
why are you saying this ? please make out my error in URL if you find .please.....
hunterzza at 2007-7-12 20:16:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
I agree I think your URL is wrong try :jdbc:oracle:thin:@172.21.1.2:1521:orcl
ita6cgra at 2007-7-12 20:16:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Dear freind ,

thanks for trying to help me but both method is correct

actually for ORACLE

the old method was

url=jdbc:oracle:thin:@<host_ip>:<port>:<SID>

the new one is

url=jdbc:oracle:thin:@//<host_ip>:<port>/<SID>

i tried your method too....:)...thanks

hunterzz

hunterzza at 2007-7-12 20:16:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Obviously it doesn't like the url=jdbc:oracle:thin:@//<host_ip>:<port>/<SID> because you are getting a

ORA-01009: missing mandatory parameter

Cause: A host language program call did not pass all required parameters. The syntax and parameter description for each call is shown in the Programmer's Guide to the Oracle Precompilers.

Action: Check the syntax for the call and enter all required parameters.

And the url=jdbc:oracle:thin:@<host_ip>:<port>:<SID> tries to connect but it doesn't like the SID

ORA-12504: TNS:listener was not given the SID in CONNECT_DATA

Cause: The SID was missing from the CONNECT_DATA.

Action: Check that the connect descriptor corresponding to the service name in TNSNAMES.ORA has an SID component in the CONNECT_DATA.

tolmanka at 2007-7-12 20:16:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

reffer

http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#05_04

according to them m URL is correct and sorry that is not SID it is SERVICE_NAME .......tnslintener.ora is correct because other application is connecting with it using this SERVICE_NAME(ORCL)....i tried that url too...but it gave me the same error ........i thing there is some concept of domain name after SERVICE_NAME like orcl.oracel.combut i m getting the same IO exception for that ....i don't know wht URL problem is there ......because my aplication administrator is saying that other applications are running fine with ORCL

hunterzza at 2007-7-12 20:16:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
is there any way to provide SID in URL because i have no permission to change TNSlistener.ora and i have to have use that ORCL......
hunterzza at 2007-7-12 20:16:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
I've used this URL before. I use the colon (':') to separate the sid from the port rather than a slash.jdbc:oracle:thin:@mydb.myhost.com:1521:hsdv01
C_Walkera at 2007-7-12 20:16:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
> I've used this URL before. I use the colon (':') to> separate the sid from the port rather than a slash.> > jdbc:oracle:thin:@mydb.myhost.com:1521:hsdv01> I've already told him that :-) see above
ita6cgra at 2007-7-12 20:16:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...