|
package com.fr.output;
|
|
|
|
import java.sql.Connection;
|
|
import java.sql.DriverManager;
|
|
import java.sql.SQLException;
|
|
|
|
import com.fr.third.net.bytebuddy.asm.Advice.This;
|
|
|
|
public class DBConnection {
|
|
private static String user = "finereport";
|
|
private static String pw = "spotfire";
|
|
private static String connUrl = "jdbc:sqlserver://128.134.187.144:11433;database=finereport;encrypt=true;trustServerCertificate=true";
|
|
|
|
public static String getConnUrl() {
|
|
return connUrl;
|
|
}
|
|
|
|
public static void setConnUrl(String connUrl) {
|
|
DBConnection.connUrl = connUrl;
|
|
}
|
|
|
|
public static String getUser() {
|
|
return user;
|
|
}
|
|
|
|
public static void setUser(String user) {
|
|
DBConnection.user = user;
|
|
}
|
|
|
|
public static String getPw() {
|
|
return pw;
|
|
}
|
|
|
|
public static void setPw(String pw) {
|
|
DBConnection.pw = pw;
|
|
}
|
|
public static Connection getConnection() throws Exception,SQLException{
|
|
Connection conn = null;
|
|
try {
|
|
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
|
conn = DriverManager.getConnection(connUrl, user, pw);
|
|
} catch (ClassNotFoundException cnfe) {
|
|
System.out.println("DB 실패1:"+cnfe.toString());
|
|
} catch (SQLException sqle) {
|
|
System.out.println("DB 실패2: "+sqle.toString());
|
|
} catch (Exception e) {
|
|
System.out.println("Unkonwn error");
|
|
e.printStackTrace();
|
|
}
|
|
return conn;
|
|
|
|
}
|
|
|
|
|
|
}
|