Subversion Repository Public Repository

Satyam

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcareemr.Util;

import java.sql.Connection;
import javax.sql.DataSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.datasource.DataSourceUtils;

// TODO: Auto-generated Javadoc
/**
 * A factory for creating Connection objects.
 */
public class ConnectionFactory{
    
    /** The con. */
    private static Connection con;
    
    /** The ds. */
    private static DataSource ds;
    public static ApplicationContext context ;
    static{
        context = new ClassPathXmlApplicationContext("healthCareDataAccessContext.xml");
        ds=(DataSource)context.getBean("dataSource");
    }
    
    /**
     * Gets the con.
     *
     * @return the con
     */
    public static Connection getCon(){
        try{
            con=DataSourceUtils.getConnection(ds);
        }catch(Exception e){
            e.printStackTrace();
        }
        return con;
    }
    
}

Commits for Satyam/AuroCareEMR/src/main/java/com/bestray/healthcareemr/Util/ConnectionFactory.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 20 Jul, 2018 05:59:17 +0000