Dbconnectionfactory Database Connection

Source: Internet
Author: User

Package Com.sprucetec.dbatch.tmsfee;

Import java.io.Serializable;
Import Java.sql.Connection;
Import Java.sql.DriverManager;
Import Java.sql.SQLException;

Import Scala.runtime.AbstractFunction0;

public class Dbconnectionfactory {

Static abstractfunction0<connection>Gettmsbasic () {
return new Abstractfunction0seri (Constants.Url4tmsbasic, Constants.User4tmsbasic, Constants.Pass4tmsbasic);

Static abstractfunction0<connection>Gettms () {
return new Abstractfunction0seri (Constants.Url4tms, Constants.User4tms, Constants.PASS4TMS);

Static abstractfunction0<connection>GETTMSDC () {
return new Abstractfunction0seri (Constants.Url4tmsdc, Constants.User4tmsdc, Constants.PASS4TMSDC);

private Static Class Abstractfunction0seriExtends abstractfunction0<connection>Implements serializable{

private static final longSerialversionuid =1L;

Private Final StringUrl;

Private Final StringUsername;

Private Final StringPassword;

Public abstractfunction0seri (String URL, String username, String password) {
This.url = URL;
This.Username = Username;
This.Password = password;

public Connection apply () {
try {
return DriverManager. getconnection (this. Url Username Password) } catch (SQLException e) {
throw new RuntimeException ( "database connection failed" , E) }


Dbconnectionfactory Database Connection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.