File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to connect servlet with mssql

 
ray bond
Ranch Hand
Posts: 111
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello there ,
I have serverlet jdbc application , which communicates with mysql database , now I have to use mssql instead of mysql , my servelets will be on "serverapplication" and mssql database is running on
"serversql" , it means to entirely different pysical server systems ,
before that mysql and servlets were on same server "serverapplication" , and below is how i did,
-- Class.forName("org.gjt.mm.mysql.Driver");
-- DriverManager.getConnection("jdbc:mysql://localhost/mydb");
now can anybody guide me that how can i access mssql database which is on different server , and what should i write ,
for "Class.forName(...." and for "DriverMgr.getCon(....",
waiting for urgent reply
thanks
 
prashant sreenivasan
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the Code
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:your_dsn");

This will solve ur problem
Prashant
[This message has been edited by prashant sreenivasan (edited April 24, 2001).]
 
David Freels
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See my reply here:
http://www.javaranch.com/ubb/Forum3/HTML/000826.html
David
Sun Certified Programmer for the Java2 Platform
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic