This week's giveaway is in the Java in General forum.
We're giving away four copies of Java Challengers and have Rafael del Nero on-line!
See this thread for details.
Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Locate my data base?

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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){}
}
}
}
=========================
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Does this tiny ad smell okay to you?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic