Package railo.runtime.db

Examples of railo.runtime.db.DatasourceConnection


  @Override
  public int doStartTag() throws PageException  {
    Object ds=getDatasource(pageContext, datasource);
    DataSourceManager manager = pageContext.getDataSourceManager();
    DatasourceConnection dc=ds instanceof DataSource?
          manager.getConnection(pageContext,(DataSource)ds,username,password):
          manager.getConnection(pageContext,Caster.toString(ds),username,password);
    try {
     
      if(type==TYPE_TABLE_COLUMNStypeColumns(dc.getConnection().getMetaData());
      else if(type==TYPE_DBNAMES)    typeDBNames(dc.getConnection().getMetaData());
      else if(type==TYPE_FOREIGNKEYStypeForeignKeys(dc.getConnection().getMetaData());
      else if(type==TYPE_INDEX)    typeIndex(dc.getConnection().getMetaData());
      else if(type==TYPE_PROCEDUREStypeProcedures(dc.getConnection().getMetaData());
      else if(type==TYPE_PROCEDURE_COLUMNS)typeProcedureColumns(dc.getConnection().getMetaData());
      else if(type==TYPE_TERMS)    typeTerms(dc.getConnection().getMetaData());
      else if(type==TYPE_TABLES)    typeTables(dc.getConnection().getMetaData());
      else if(type==TYPE_VERSION)    typeVersion(dc.getConnection().getMetaData());
      else if(type==TYPE_USERS)    typeUsers(dc.getConnection().getMetaData());
     
    }
    catch(SQLException sqle) {
      throw new DatabaseException(sqle,dc);
    }
View Full Code Here


  public int doEndTag() throws PageException  {

    Object ds=Insert.getDatasource(pageContext,datasource);
   
    DataSourceManager manager = pageContext.getDataSourceManager();
      DatasourceConnection dc=ds instanceof DataSource?
          manager.getConnection(pageContext,(DataSource)ds,username,password):
          manager.getConnection(pageContext,Caster.toString(ds),username,password);
    try {
     
      Struct meta =null;
View Full Code Here

    }
  }
 
  private railo.runtime.type.Query executeDatasoure(SQL sql,boolean createUpdateData,TimeZone tz) throws PageException {
    DatasourceManagerImpl manager = (DatasourceManagerImpl) pageContext.getDataSourceManager();
    DatasourceConnection dc=manager.getConnection(pageContext,datasource, username, password);
   
    try {
      if(lazy && !createUpdateData && cachedWithin==null && cachedafter==null && result==null)
        return new SimpleQuery(dc,sql,maxrows,blockfactor,timeout,getName(),pageContext.getCurrentPageSource().getDisplayPath(),tz);
     
View Full Code Here

  }
 
  public DatasourceConnection _getConnection(DataSource ds, String user,String pass) throws PageException {
   
    String id=DatasourceConnectionPool.createId(ds,user,pass);
    DatasourceConnection dc=conns.get(id);
    if(dc!=null && DatasourceConnectionPool.isValid(dc,null)){
      return dc;
    }
    dc=config.getDatasourceConnectionPool().getDatasourceConnection(this,ds, user, pass);
    conns.put(id, dc);
View Full Code Here

  }
 
  private Core getCore(ConnectionData data) throws PageException{
    Core core = (Core) cores.get(data.datasourceName);
    if(core==null){
      DatasourceConnection dc = getManager().getConnection(ThreadLocalPageContext.get(), data.getDatasourceName(), data.getUsername(), data.getPassword());
      try {   
       
        dc.getConnection().setAutoCommit(false);
        dc.getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
       
        if("com.microsoft.jdbc.sqlserver.SQLServerDriver".equals(dc.getDatasource().getClazz().getName()))
          core=new MSSQL(dc,data.getPrefix());
        else if("com.microsoft.sqlserver.jdbc.SQLServerDriver".equals(dc.getDatasource().getClazz().getName()))
          core=new MSSQL(dc,data.getPrefix());
        else if("net.sourceforge.jtds.jdbc.Driver".equals(dc.getDatasource().getClazz().getName()))
          core=new MSSQL(dc,data.getPrefix());
        else if("org.gjt.mm.mysql.Driver".equals(dc.getDatasource().getClazz().getName()))
          core=new MySQL(dc,data.getPrefix());
        else
          throw new ApplicationException("there is no DatasourceResource driver for this database ["+data.getPrefix()+"]");
       
        cores.put(data.datasourceName, core);
View Full Code Here

    }
    return core;
  }
 
  private DatasourceConnection getDatasourceConnection(ConnectionData data, boolean autoCommit) throws PageException {
    DatasourceConnection dc = getManager().getConnection(ThreadLocalPageContext.get(), data.getDatasourceName(), data.getUsername(), data.getPassword());
   
    try {
      dc.getConnection().setAutoCommit(autoCommit);
      dc.getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
    }
    catch (SQLException e) {
      throw new DatabaseException(e,dc);
    }
   
View Full Code Here

    }
  }
 
  private Attr _getAttr(ConnectionData data, int fullPathHash,String path, String name) throws PageException {
    if(!StringUtil.isEmpty(data.getDatasourceName())) {
      DatasourceConnection dc=null;
      try
        dc = getDatasourceConnection(data)
        Attr attr=getCore(data).getAttr(dc,data.getPrefix(),fullPathHash,path,name);
        if(attr!=null)return putToCache(data,path,name, attr);
      }
View Full Code Here

      return null;
   
    //Attr[] attrs = getFromCache(data, path);
    //if(attrs!=null) return attrs;
   
    DatasourceConnection dc=null;
    try {   
      dc = getDatasourceConnection(data);
      List list=getCore(data).getAttrs(dc,data.getPrefix(),pathHash,path);
     
      if(list!=null){
View Full Code Here

      throw new IOException("missing datasource definition");
   
    removeFromCache(data, path, name);
   

    DatasourceConnection dc=null;
    try {   
      dc = getDatasourceConnection(data);
      getCore(data).create(dc,data.getPrefix(),fullPathHash, pathHash,path,name,type);
    }
    catch (SQLException e) {
View Full Code Here

  public void delete(ConnectionData data, int fullPathHash,String path, String name) throws IOException {
   
    Attr attr = getAttr(data, fullPathHash,path, name);
    if(attr==null) throw new IOException("can't delete resource "+path+name+", resource does not exist");
   
    DatasourceConnection dc=null;
    try {   
      dc = getDatasourceConnection(data);
      getCore(data).delete(dc,data.getPrefix(),attr);
    }
    catch (SQLException e) {
View Full Code Here

TOP

Related Classes of railo.runtime.db.DatasourceConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.