• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connecting to Database without a DSN

 
Mahua Dutta
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to connect to the database through a java application running in a client machine without a DSN. I mean can we access to a database in the server like we access through servlets.
I am using the following strings
String url = "jdbc racle:thin:@SERVER's IP ADDRESS:PORT:SERVICE_NAME";
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
con = DriverManager.getConnection(url, "mis", "mis");
But I am getting the following Exception
oracle.jdbc.driver.OracleDriver
I am using same Strings and driver to access the database through servlets and its working properly.
Its very urgent. If any one can help me, Please.
Regards Mahua
[This message has been edited by Mahua Dutta (edited September 22, 2001).]
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
Try this instead of the ClassforName() technique:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
its from the Oracle docs.
Hope that helps,
Terry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic