I am trying to connection pool a AS400 JDBC Connection. Have been trying to 
find a good tutorial but have yet to find one. 

Basically right now for each user I am creating a connection (example below). I 
would like to get a pool of these types of connections that expands when 
necissary, and contracts say after 30 minutes.


  | public static java.sql.Connection getApplicationSecurityConnection() {
  |             String description =    "Connection to the Application Security 
Database";
  |             //String driver =               "com.inet.tds.TdsDriver";
  |             //String protocol =             "inetdae";
  |             //String serverDNS =            "localhost";
  |             //String port =                         "1433";
  |             //String instance =             "";
  |             //String database =             "APP_SECURITY";
  |             //String user =                         "security";
  |             //String password =             "ssSetjESN5sgve6jQdNM8BTra";
  |             
  |             String driver =                 
"com.ibm.as400.access.AS400JDBCDriver";
  |             String protocol =               "";
  |             String serverDNS =              "";
  |             String port =                   "";
  |             String instance =               "";
  |             String database =               "";
  |             String user =                   "CPSERVER";
  |             String password =               "CPPROFILE";
  |             
  |             
  |                                                                             
                                                  
  |             java.sql.Connection conn = null;
  |             try {                    
  |                     // make sure DriverManager can load proper class to 
establish connection
  |                     Class.forName(driver);
  |                     String URL = "jdbc:" + protocol + ":" + serverDNS;
  |                     Properties DBProperties = new Properties();
  |                     if (!port.equals("")){
  |                             DBProperties.setProperty("port",port);  
  |                     }
  |                     if (!instance.equals("")){
  |                             DBProperties.setProperty("instance",instance);  
                        
  |                     }
  |                     if (!database.equals("")){
  |                             DBProperties.setProperty("database",database);
  |                     }
  |                     if (!user.equals("")){
  |                             DBProperties.setProperty("user",user);  
  |                     }
  |                     if (!password.equals("")){
  |                             DBProperties.setProperty("password",password);  
  |                     }
  |                     if(!getApplicationName().equals("")){
  |                             
DBProperties.setProperty("appname",getApplicationName());
  |                     }
  |                     conn = DriverManager.getConnection(URL,DBProperties);
  |                     if (conn == null){
  |                             throw new Exception("getDATAConnection(String, 
String): Unspecified error occured.");
  |                     }
  |             } catch (Exception e) {
  |                     
System.out.println("\n\n*******************************************************");
  |                     System.out.println("CONNECTION ERROR!!!!");
  |                     System.out.println("DESCRIPTION: " + description);
  |                     System.out.println("ERROR: " + e.getMessage());
  |                     
System.out.println("\n\n*******************************************************");
  |                     e.printStackTrace();
  |             }
  |             return conn;
  |     }

any help us MUCH appreciated

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994347#3994347

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994347
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to