Click here to Skip to main content
16,010,544 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

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


were to write this above connection in java file.
Posted
Updated 19-Sep-11 23:38pm
v5
Comments
TorstenH. 20-Sep-11 4:28am    
added DB tags

- 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.
 
Share this answer
 
You can set those values static in a interface-file:

Java
public interface ConnectionSettings{

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


and then use it in another class:

Java
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?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900