Dblink无法在java

时间:2017-04-20 12:19:56

标签: eclipse

String id="";
            List list = null;
            Query query = null;
            Session session = getSession();
String sql = "select id from student@dblink s, location@dblink l where s.id in (select name from Employ where id='" +Id +"') and s.country_id = l.country_id and l.country_end = '"+countryEnd+"'";
            query = session.createSQLQuery(sql);
            System.out.println("sql.1."+sql);
            list = query.list();
            if(list.size()>0)
                id = list.get(0).toString();
            else
                id= "0";
            System.out.println("Stage2Ubr Id is:"+id);
            return id;

这里我得到了例外" org.hibernate.exception.GenericJDBCException:无法执行查询"。有时这个例外不会到来。有时候它毫无例外地正常工作。如果dblink工作正常,这个例外就不会发生。请帮助我。如何检查dblink是否正常工作?

0 个答案:

没有答案