Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MS-SQL database instance connection  RSS feed

 
Hardy Chou
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, currently i am given this db account, lets say ABC\DEF with DEF as the
instance, and i also have the username and password. however, i dun
understand how to connect to that server. below is the code I use. do i set
the url correctly?
String url = "jdbc:microsoft:sqlserver://ABC/DEF:1433";
String username= "eventsappdev" ;
String password= "hardyboys" ;
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con = DriverManager.getConnection(url,username,password);
stmt = con.createStatement();
PS: I am using msbase.jar, msutil.jar, mssqlserver.jar from microsoft. Tomcat 4.0.4 and remote MS-SQL db server.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!