Want to create dynamic table with spring and ibatis

Posted on 2008-11-09
Last Modified: 2013-12-07
I want to create the dynamic table in DAO layer. I need create the table insert the some records and drop the table all these has to happen in DA layer. Please let me know any one has info
Question by:atmohsin
    LVL 26

    Expert Comment

    In MySQL dynamically tables can be created in this way..
    set @table_name := 'mytable';
    set @sql_text:=concat('create table ',@table_name,'(id int unsigned)');
    PREPARE stmt1 FROM @sql_text;
    EXECUTE stmt1;
    # Your insert stuff can go here
    # Later drop the table

    Open in new window


    Author Comment


    I am using the spring+ibatis and mysql server there is DAO layer which interact with DB.

    Suppose for updating the result into db we are using following codegetSqlMapClientTemplate().update("updateTestRunSyncStatus", listTestRunIds);

    I am not able to get for creating table
    suppose i have
    String sql="create test (id int,name varchar2(10));
    now i need to execute this query.

    LVL 26

    Accepted Solution


    Syntax should be
    create table test (id int,name varchar(10)

    This may help you...


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    Creating and Managing Databases with phpMyAdmin in cPanel.
    This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
    This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now