Can't insert data to database

technical benerator q&a

Can't insert data to database

Postby rpa2912 » Thu Oct 20, 2011 2:20 am

I'm sorry if there's already a similar thread, but I just can't found it. I'm a new Benerator user, currently I'm trying to do a simple database population task. However, when I run it, it seems stuck at "INFO (main) [JDBCDBImporter] Importing tables" part.

Here is my benerator.xml code:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<setup xmlns="http://databene.org/benerator/0.7.1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://databene.org/benerator/0.7.1 benerator-0.7.1.xsd"
        defaultEncoding="Cp1252"
        defaultDataset="US"
        defaultLocale="en_US"
        defaultLineSeparator="\r\n">

   <comment>
       Populates a database
   </comment>
   
    <comment>defining a database that will be referred by the id 'db' later</comment>
    <database id="db"
        url="jdbc:jtds:sqlserver://mtpc221:1433/testdb;instance=SQL2008"
        driver="net.sourceforge.jtds.jdbc.Driver"
        schema="dbo"
   catalog="testdb"
        user="testdb"
        password="testdb"
   batch="false"/>
      
   <bean id="idGen" spec="new IncrementGenerator(100)" />

   <comment>Drop the testtable if it already exist. If it does not exist yet, the error message is ignored</comment>
   <execute target="db" onError="ignore">
      drop table testtable;
   </execute>
   
   <comment>Creating testtable</comment>
   <execute target="db" >
      create table testtable (
         id int not null,
         n  int not null,
         o int null,
         primary key (id)
      )
   </execute>
   
   <comment>Generating 100 entries for testtable</comment>
   <generate type="testtable" consumer="db,ConsoleExporter" count="100">
      <id name="id" generator="idGen"/>
      <attribute name="n" min="1" max="42" distribution="cumulated"/>
      <attribute name="o" min="100" max="150" distribution="cumulated"/>
   </generate>

</setup>


and here's the output when I tried to run it:
Code: Select all

D:\My Documents\Work\project\my project\extra\Benerator\databene-benerator-0.7
.1\bin>benerator.bat populi\benerator.xml
Local classpath: .;D:\My Documents\Work\project\my project\extra\Benerator\dat
abene-benerator-0.7.1\bin;D:\My Documents\Work\project\my project\extra\Benera
tor\databene-benerator-0.7.1\lib\*
09:03:24,264 INFO  (main) [CONFIG] Running file populi\benerator.xml
09:03:24,264 INFO  (main) [CONFIG] Benerator 0.7.1 build 1820
09:03:24,264 INFO  (main) [CONFIG] Java version 1.6.0_10
09:03:24,264 INFO  (main) [CONFIG] JVM Java HotSpot(TM) Client VM 11.0-b15 (Sun
Microsystems Inc.)
09:03:24,264 INFO  (main) [CONFIG] OS Windows XP 5.1 (x86)
09:03:24,264 INFO  (main) [CONFIG] Installed JSR 223 Script Engines:
09:03:24,264 INFO  (main) [CONFIG] - Mozilla Rhino[js, rhino, JavaScript, javasc
ript, ECMAScript, ecmascript]
09:03:24,280 INFO  (main) [CONFIG] Max heap size: 63 MB
09:03:24,295 DEBUG (main) [CONFIG] Initializing Script mapping from file org/dat
abene/script/script.properties
09:03:24,823 DEBUG (main) [COMMENT] Populates a database
09:03:24,823 DEBUG (main) [COMMENT] defining a database that will be referred by
 the id 'db' later
09:03:24,839 DEBUG (main) [COMMENT] Drop the testtable if it already exist. If i
t does not exist yet, the error message is ignored
09:03:24,855 INFO  (main) [EvaluateStatement] Executing inline script
09:03:25,290 INFO  (main) [JDBC] Connected to Microsoft SQL Server 10.00.1600
09:03:25,290 INFO  (main) [JDBC] Using driver jTDS Type 4 JDBC Driver for MS SQL
 Server and Sybase 1.2
09:03:25,290 INFO  (main) [JDBC] JDBC version 3.0
09:03:25,305 DEBUG (main) [COMMENT] Creating testtable
09:03:25,305 INFO  (main) [EvaluateStatement] Executing inline script
09:03:25,305 DEBUG (main) [COMMENT] Generating 100 entries for testtable
09:03:25,414 INFO  (main) [JDBCDBImporter] Importing tables



The table is created but after the importing tables part, it sort of stuck. I've previously tried the "Hello World" example and it works normally. Any solution for this problem?

I'm using SQL Server 2008 for the database, and I'm running this on Windows XP SP3. The database schema is freshly added, there are no other table exist in the schema.
rpa2912
 
Posts: 2
Joined: Thu Oct 20, 2011 2:05 am

Re: Can't insert data to database

Postby firefox28 » Tue Nov 01, 2011 5:42 pm

Hi rpa2912,

I have the same issue. At "Importing tables" step, benerator is waiting and I see a lock in MS SQL Server 2008 R2 (LCK_M_S) and the associated task is suspended.

I have tried with several distributions and got this results:
0.6.3 - it's working
0.6.4 - java.lang.NullPointerException
0.6.5 - org.databene.commons.ObjectNotFoundException: Catalog not found: null
0.6.6 - 18:30:06,976 INFO (main) [JDBCDBImporter] Importing tables - it's waiting .....
0.7.1 - 18:40:09,795 INFO (main) [JDBCDBImporter] Importing tables - it's waiting .....
0.7.2 - 18:50:09,795 INFO (main) [JDBCDBImporter] Importing tables - it's waiting .....

This issue has been raised here viewtopic.php?f=2&t=470&p=1487&hilit=Importing+tables#p1411 but that topic has been locked without a solution or a workaround

I'm stuck too with the benerator evaluation ...

Cheers,
Arminio
firefox28
 
Posts: 2
Joined: Tue Nov 01, 2011 9:41 am

Re: Can't insert data to database

Postby Volker Bergmann » Fri Jan 20, 2012 7:10 pm

This issue has been raised here [...] but that topic has been locked without a solution or a workaround


The shortest possible answer is RTFM

A faster help (at least for the reader) is probably this one: Yes the topic has been locked, but no, there is no solution or workaround to apply but wait: Benerator imports the meta data of all tables provided to him by the database server through the JDBC API. Depending on the database size (and the ratio of lazyness to cleverness of the vendor's JDBC driver programmers) this can take extremely long. For example I am regularly working with large Oracle instances with lots of test schemas deployed and it takes 30-90 minutes in the local network until meta data is provided. Trying this over a VPN doubles the time consumed and using an intercontinental connection, the VPN cancels the transfer after 24 hours.

So if you really think, that "Benerator is stuck", please do as advised in the referred post and set the log levels in order to be able to tell if "stuck" is the proper wording, instead of simply blaming other people to close a topic without providing a solution or workaround. Especially if manual and web page provide chapters called "Troubleshooting" and "Performance Tuning" which address these issues and their solution.

For example, looking at the last pages of the Benerator manual you can find some further advice on "Parsing (Oracle) metadata" issues:
- Purge the recycle bin
- use the 'includeTables' attribute of the <database> element
- cache the meta data

If you configure logging to see what happens while you are waiting, and you notice that some metadata retrieval operation types are especially slow for your database system, please tell and I will try to improve them - I am regularly adding performance improvements. You should always use the newest Benerator version, which will be 0.7.5 by the end of January 2012, a beta version is already available at http://databene.org/download/databene-b ... 5-dist.zip and is to be preferred over older 0.7.x version, since it provides some fixes of critical bugs in data import and address data generation.

...and most of all: Don't downrate an application on Sourceforge if you are too lazy to learn it and too scrimpy to buy support!
Volker 'databene' Bergmann

Need faster response times? phone support? onsite support? training? custom extensions? immediate bug fixes? Support Benerator evolution by buying services from Volker Bergmann!
User avatar
Volker Bergmann
 
Posts: 654
Joined: Sat Nov 10, 2007 2:40 pm


Return to Benerator Help

Who is online

Users browsing this forum: No registered users and 2 guests