aspose file tools*
The moose likes JDBC and the fly likes oracle error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "oracle error" Watch "oracle error" New topic
Author

oracle error

jacq carballo
Ranch Hand

Joined: Feb 10, 2002
Posts: 42
I have made a small program that will connect to the oracle db. I also added catch blocks to find out when something goes wrong.
This is the code block:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url = "jdbc racle:thin:10.0.0.2:1433";
String username = "user";
String password = "password";
DriverManager.getConnection(url,username,password);
This is the error:
SQLException
SQLState: null
Message: Io exception: The Network Adapter could not establish the connection
Vendor:17002
when i try the same code with the sqlserver (of course i changed the first line to Class.forName(com.ms.jdbc.sql....), the url, username and password), it works just fine.
Can anyone tell me what is wrong with the code above? What can i do to remove the error?
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
String url = "jdbc: oracle:thin@10.0.0.2:1433:<SID>;
I hope this helps
Nigel
[ February 14, 2002: Message edited by: Nigel Browne ]
[ February 14, 2002: Message edited by: Nigel Browne ]
jacq carballo
Ranch Hand

Joined: Feb 10, 2002
Posts: 42
I made the code changes but this next problem came out:
SQLException:
SQLState: null
Message: Invalid Oracle URL
Vendor: 17067
I am sure that the IP address and the port number i used are correct because i telnet to them all the time (and i rechecked them to make sure i did not do any typo error).
Thanks in advance.
martin samm
Ranch Hand

Joined: Nov 09, 2000
Posts: 31
the connection string is missing a colon. It should be :
jdbc racle:thin:@<machineip/name>:<port>:<sid>


martin samm<BR>m_sam@rroom.net
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: oracle error