多种方法的连接池 [英] connection Pooling for Multiple Methods

查看:68
本文介绍了多种方法的连接池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hai

我有多种方法..我需要使用规则和法规来调用所有方法的连接池.发送该源代码

hai

i have multiple methods..i need to call the connection pooling to all methods with rules and regulation. send the source code for that

conPool pool= new conPool ( "com.mysql.jdbc.Driver", "jdbc:mysql://" + "195.168.1.100:3306" +"/", "mysql", "mysql", 0,20 ,true); 



都是在Java文件中编写以上连接.



were to write this above connection in java file.

推荐答案

-什么类型的数据库?
- 问题出在哪儿?从来没有使用过面向对象的语言?
-...
-当您在此处发送代码时,我们将不胜感激,只需添加即可.
- What type of DB?
- where is the problem? never worked with OO-related languages?
- ...
- we appreciate it when you send code here and we just add in.


您可以在接口文件中将这些值设置为静态值:

You can set those values static in a interface-file:

public interface ConnectionSettings{

  public final static String 
     DRIVER = "",
     ADDRESS = "";
}



然后在另一个类中使用它:



and then use it in another class:

public class DBConnector implements ConnectionSettings{

  public void someWiredFunction(){
     conPool pool= new conPool ( 
        DRIVER, 
        "jdbc:mysql://" + ADDRESS +"/", 
        "mysql", 
        "mysql", 
        0,
        20 ,
        true
      ); 

  }
}



还是将它们作为可以在产品上稍后更改的属性?



or do you want them as properties that can be changed later at the product?


这篇关于多种方法的连接池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆