Powered by Blogger.

Friday, 22 August 2014

MSSql Server Authentication

By Unknown  |  08:34 No comments

private final static String databaseName="Map";
private final static String url = "jdbc:sqlserver://localhost;database="+databaseName;
private final static String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
private final static String userName = "sa";
private final static String password = "password123";
public static Connection getConnection() throws Exception {
if (connection != null)
return connection;
else {
try {
Class.forName(driver).newInstance();
connection = DriverManager.getConnection(url, userName, password);
} catch (Exception e) {
e.printStackTrace();
}
return connection;
}
}

Author: Unknown

Hello, I am Author, decode to know more: In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet.

0 comments:

Recent Articles

© 2014 Learning Java. WP themonic converted by Bloggertheme9. Published By Gooyaabi Templates
TOP