[Building Sakai] jdbc spring slowly
yolima u
yolimita.uribe at gmail.com
Thu May 28 10:58:32 PDT 2009
well, in a old post i asked if i could delete component.xml,
spring-hibernate.xml, and sakai-hibernate.xml because i'm not using
hibernate, and the answer was ok so i did it. Anyway, when i build my tool,
in tomcat/component/mytool-pack/ are this files anyway, so this files that
i'm add, are in tomcat/component/mytool-pack/ not in sakai/mytool/pack
http://www.nabble.com/file/p23766822/components.xml components.xml
http://www.nabble.com/file/p23766822/sakai-hibernate.xml sakai-hibernate.xml
http://www.nabble.com/file/p23766822/spring-hibernate.xml
spring-hibernate.xml
yolima u wrote:
>
> hi,
>
> i don't now what i'm doing wrong. Yesterday when i changed my class like
> you told me, my tool worked fine, but today i'm doing new things and it's
> slowly again! and becoming worse. Every time that i do a new insert o
> update, is more slow. the first insert of today was slow but later of
> other 3 or 4, now it's really slow, so much, like 3 minutes again :(
>
> why?
>
> what am i doing wrong?
>
> this is my classes:
> http://www.nabble.com/file/p23765978/OBJESPECIFICO.java
> OBJESPECIFICO.java
>
> my Daojdbc
>
> http://www.nabble.com/file/p23765978/MetoGWDao.java MetoGWDao.java
>
> my jsp page
>
> http://www.nabble.com/file/p23765978/nuevo_modificar_oe.jsp
> nuevo_modificar_oe.jsp
>
>
> Aaron Zeckoski wrote:
>>
>> Normally spring jdbc will do a commit for each update/insert/delete
>> that you run using the jdbctemplate. If you are doing a lot of these
>> without a transactional wrapper then it can be a little bit expensive
>> (though not typically the amount of time you are talking about).
>>
>> I recommend you try using the spring JdbcDaoSupport class and take a
>> look at the example code here:
>> http://bugs.sakaiproject.org/confluence/display/BOOT/Spring+JDBC+Info
>>
>> It may help to clean up all the empty try/finally blocks in your code
>> for readability when pasting it here. You also might want to send
>> along your spring configuration file along with your code.
>> Hope this helps
>> :-)
>> -AZ
>>
>>
>> On Wed, May 27, 2009 at 1:54 AM, yolima u <yolimita.uribe at gmail.com>
>> wrote:
>>>
>>> hi all,
>>> i'm developing a tool in sakai using jdbc spring for the connection
>>> to
>>> the data base
>>> i'm working with a bean where i create all the functions for the data
>>> base:
>>>
>>> public class MetGwBean {
>>>
>>> private DataSource dataSource;
>>>
>>> public void setDataSource(DataSource dataSource) {
>>> this.dataSource = dataSource;
>>> }
>>>
>>>
>>>
>>> public void Insertar(String sql,Object[] obj)throws SQLException{
>>>
>>>
>>> JdbcTemplate sel = new JdbcTemplate(dataSource);
>>>
>>> try {
>>> sel.update(sql, obj);
>>> // do things with your connection (select, insert,
>>> delete, etc.)
>>> } finally {
>>>
>>> }
>>> }
>>>
>>> public List SelectObjetos(String sql,Object[] obj)throws
>>> SQLException{
>>>
>>> JdbcTemplate sel = new JdbcTemplate(dataSource);
>>> try{
>>> return sel.queryForList(sql, obj, String.class);
>>> }finally{
>>>
>>> }
>>> }
>>>
>>> public List Selectsolo(String sql)throws SQLException{
>>>
>>> JdbcTemplate sel = new JdbcTemplate(dataSource);
>>> try{
>>> return sel.queryForList(sql,String.class);
>>> }finally{
>>>
>>> }
>>> }
>>>
>>> public void Borrar(String sql,Object[] obj)throws SQLException{
>>>
>>>
>>> JdbcTemplate sel = new JdbcTemplate(dataSource);
>>>
>>> try {
>>> sel.update(sql, obj);
>>> // do things with your connection (select,
>>> insert, delete, etc.)
>>> } finally {
>>>
>>> }
>>>
>>> }
>>>
>>> public void Actualizar(String sql,Object[] obj)throws
>>> SQLException{
>>>
>>>
>>> JdbcTemplate sel = new JdbcTemplate(dataSource);
>>>
>>> try {
>>> sel.update(sql, obj);
>>> // do things with your connection (select,
>>> insert, delete, etc.)
>>> } finally {
>>>
>>> }
>>>
>>> }
>>>
>>> public String Selectid(String sql,Object[] obj)throws
>>> SQLException{
>>>
>>> JdbcTemplate sel = new JdbcTemplate(dataSource);
>>> try{
>>> return (String)sel.queryForObject(sql, obj,
>>> String.class);
>>> }
>>> finally{
>>>
>>> }
>>> }
>>>
>>> public int Selectint(String sql,Object[] obj)throws SQLException{
>>>
>>> JdbcTemplate sel = new JdbcTemplate(dataSource);
>>> try{
>>> return sel.queryForInt(sql, obj);
>>> }
>>> finally{
>>>
>>> }
>>> }
>>> }
>>>
>>>
>>>
>>> later i call this functions in a jsp page, for example:
>>>
>>>
>>>
>>> if (request.getParameter("guardar")!=null)
>>> {
>>> if (request.getParameter("textarea")!=null)
>>> {
>>> objgen.setProyecto(bean2.getCurrentSiteId());//id
>>> del proyecto
>>> String
>>> idobgen=bean.Selectid(objgen.SqlObjId(),objgen.ObjetoBuscar(objgen));//buscar
>>> el id del obj general
>>>
>>> objesp.setObjgeneral(Integer.parseInt(idobgen));//id de obj general en
>>> obj esp
>>>
>>> objesp.setdescObjetivo(request.getParameter("textarea"));
>>> objesp.setAutor(bean2.getCurrentUserId());
>>> objesp.setestado("en definicion");
>>> objesp.setprioridad(0);
>>>
>>> bean.Insertar(objesp.SqlInsertar(),objesp.ObjetoInsertar(objesp));
>>> response.sendRedirect("objetivos_esp.jsp");
>>> return;
>>> }
>>> }
>>>
>>> the problem is that the tool is fast for to do the select, but the tool
>>> takes so much time for to do the inserts, like 3 to 4 minutes.
>>>
>>> and in some jsp pages i need show data of the data base that i just
>>> insert
>>> to the DB, but how the tool does this so slowly, the jsp page can't show
>>> this data.
>>>
>>> why does the tool do the insert to slowly?
>>> what can i do for do this more fast?
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/jdbc-spring-slowly-tp23734131p23734131.html
>>> Sent from the Sakai - Development mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> sakai-dev mailing list
>>> sakai-dev at collab.sakaiproject.org
>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>>
>>> TO UNSUBSCRIBE: send email to
>>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>>> "unsubscribe"
>>>
>>
>>
>>
>> --
>> Aaron Zeckoski (aaronz at vt.edu)
>> Senior Research Engineer - CARET - Cambridge University
>> [http://bugs.sakaiproject.org/confluence/display/~aaronz/]
>> Sakai Fellow - [http://aaronz-sakai.blogspot.com/]
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to
>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> "unsubscribe"
>>
>
>
--
View this message in context: http://www.nabble.com/jdbc-spring-slowly-tp23734131p23766822.html
Sent from the Sakai - Development mailing list archive at Nabble.com.
More information about the sakai-dev
mailing list