Title: Directly insert data from java program
Last modified: August 19, 2016

---

# Directly insert data from java program

 *  [shotaz](https://wordpress.org/support/users/shotaz/)
 * (@shotaz)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/directly-insert-data-from-java-program/)
 * I’m totally new to wordpress. I have a program i built in java and up to now 
   i’ve been using it to add data to a pligg website. Thing is the database has 
   about 100k of records in there now and the site has started to drag after looking
   into it i found that it was the amount of database queries being made by the 
   CMS asked a few people around the office and they said wordpress could solve 
   my worries.
    I had a look at the documentation on the wordpress database structure
   and thought i had it but not quite. The program successfully inserted records
   to a certain level the content and title seemed to got in right.
 * Tags don’t display and i’m using the simple video embeder and the data being 
   stored is all about videos. I’m using a series of sql statements to get all the
   data in and i’ll paste it below.
 * Can anyone suggest a better way of achieving this or does wordpress have a better
   way to get external data in without going directly to sql (although i think it
   would be best to connect to the database since any php script would be called
   several times to insert records and the program has several threads inserting
   data at the same time)…
 * The sql i’ve got is:
 *     ```
       sql = "INSERT INTO wp_epsez1_posts ( post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status,post_name, to_ping, pinged, post_modified, post_modified_gmt, post_content_filtered, post_parent, guid, menu_order, post_type, post_mime_type, comment_count)"
                               + "VALUES ('1', '" + timeNow + "', '" + timeNow + "', '" + description + "', '" + title + "', '" + title + "', 'publish', 'open', 'open', '" + title.replaceAll("[^a-zA-Z0-9_]", "-").replaceAll("(.)\\1+", "$1") + "', '', '', '" + timeNow + "', '" + timeNow + "', '', '0', '', '0', 'post', '', '0');";
       sql = "UPDATE wp_epsez1_posts SET guid='http://www.dibb.it/category/" + getCat(title)[0] + "/?p=" + linkId + "' WHERE post_date='" + timeNow + "'";
       sql = "INSERT INTO wp_epsez1_postmeta (post_id, meta_key, meta_value) VALUES"
                                   + "( '" + linkId + "', '_edit_lock', '1271217131'),"
                                   + "( '" + linkId + "', '_edit_last', '1'),"
                                   + "('" + linkId + "', '_p75_thumbnail', 'default.jpg'),"
                                    + "('" + linkId + "', 'link_url', '"+url+"'),"
                                   + "('" + linkId + "', 'ratings_users', '1'),"
                                   + "('" + linkId + "', 'ratings_score', '2'),"
                                   + "('" + linkId + "', 'ratings_average', '2');";
          sql = "INSERT INTO wp_epsez1_postmeta (post_id, meta_key, meta_value) VALUES ('" + linkId + "', '_videoembed_manual', '" + embedTag.replaceAll("'", "") + "')";
        sql = "INSERT INTO  wp_epsez1_terms (name ,slug)VALUES ('" + tags[i] + "',  '" + tags[i].replaceAll("[^a-zA-Z0-9_]", "-") + "');";
   
       sql = "Select term_id from wp_epsez1_terms where slug='" + tags[i].replaceAll("[^a-zA-Z0-9_]", "-") + "' ORDER BY term_id DESC LIMIT 1";
   
                       sql = "INSERT INTO wp_epsez1_term_relationships (object_id,term_taxonomy_id) VALUES('" + linkId + "','" + getCat(title)[1] + "')";
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [shotaz](https://wordpress.org/support/users/shotaz/)
 * (@shotaz)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/directly-insert-data-from-java-program/#post-1465136)
 * I’m not sure what other info might be of use but ask and i’ll try to provide 
   it if i can. Not sure if it is of use but i’m modifying the woogle theme from
   [ woogle ](http://ericulous.com/2009/03/18/wp-theme-woogle-the-google-search-engine-clone/).
   
   An embed code is loaded from the postmeta table with metakey being _videoembed_manual
   and the meta_value being the embed code.
 * Any help is greatly appreciated, thanks in advance

Viewing 1 replies (of 1 total)

The topic ‘Directly insert data from java program’ is closed to new replies.

## Tags

 * [external data](https://wordpress.org/support/topic-tag/external-data/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 1 reply
 * 1 participant
 * Last reply from: [shotaz](https://wordpress.org/support/users/shotaz/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/directly-insert-data-from-java-program/#post-1465136)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
