what is the connectivity code of sql server with java
Printable View
what is the connectivity code of sql server with java
You need to get the SQL Server JAR from somewhere, then this is the basic setup:
That should do it for you...Code:
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); // this statically initialises the driver.
String url = "jdbc:microsoft:sqlserver://<host>:<port>;DatabaseName=<databasename>";
String username = "sa";
String password = "yourpassword"
Connection c = DriverManager.getConnection(this.url, username, password);