Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to connect with mssql

 
ray bond
Ranch Hand
Posts: 111
  • 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
 
David Freels
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Windows use this:
-- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
-- DriverManager.getConnection("jdbc dbc SNNAME");
Where DSNNAME equals the DSN set up to connect to the SQL Server.
For non windows, go to http://www.inetsoftware.de and take a look at the commercial drivers available.
David
Sun Certified Programmer for the Java2 Platform
 
ray bond
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply , its working now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic