-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: using a load infile data
PostPosted: Sat Mar 31, 2007 6:15 am 
Newbie

Joined: Mon Sep 04, 2006 1:27 pm
Posts: 9
I'm trying to load a file into a table from a file ,could somebody put here an example with the hibernate classes to execute the trasaction
load data infile 'xxx' into the table xxx fields terminated by ',' passing this statement .
there is any class of hibernate just to make the classic executeupdate of the statement class?


Top
 Profile  
 
 Post subject: using load data infile
PostPosted: Sun Apr 01, 2007 5:42 pm 
Newbie

Joined: Mon Sep 04, 2006 1:27 pm
Posts: 9
I answer my self:
.....
Session session=hibernateTemplate.getSession();
Transaction tx = null;
Connection conn = session.connection();
try {
Statement stmt = conn.createStatement();
tx = session.beginTransaction();
stmt.executeUpdate("load data infile '"+filepath+"' into table xxxx FIELDS TERMINATED BY ',';");
tx.commit();
stmt.close();
}catch (SQLException e){
...
that work fine
notes :
transaction and session both are of org.hibernate.*
connection of java.sql.*


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.