This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Locate my data base?

 
darine darine
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic