aspose file tools*
The moose likes Tomcat and the fly likes Locate my data base? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Locate my data base?" Watch "Locate my data base?" New topic
Author

Locate my data base?

darine darine
Ranch Hand

Joined: Mar 08, 2001
Posts: 43
Hi
Hi all
I'm trying to connect from my webapp running on Tomcat to my database which is oracle and it is on my LOCALE MACHINE on drive c:\oracle.
so i need to write the right url to coonect to it.
please any help?
Thanks .
Here is my java class
=========================
import java.sql.*;
import java.util.*;
public class attemptConnection
{
public static void main(String arg[])
{
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
//Here how do i specify the subname to locate my database
con = DriverManager.getConnection("jdbc racle:thin:@147.89.124.140:1527 MS", "scott", "tiger");
stmt = con.createStatement();
}
catch(ClassNotFoundException e)
{
System.out.println("Couldn't load database driver: " + e.getMessage());
}
catch(SQLException e)
{
System.out.println("SQLException caught: " + e.getMessage());
}
finally
{
try
{
if(con != null) con.close();
}
catch(SQLException ignored){}
}
}
}
=========================
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Normally, the default port for Oracle is 1521. There should also be a colon between the port and SID name.

jdbcracle:thin:@localhost:1521:MS
 
jQuery in Action, 2nd edition
 
subject: Locate my data base?