how to insert html data into blob column in oracle

solution 1:

Yes, it’s possible, e.g. using the implicit conversion from RAW to BLOB:

insert into blob_fun values(1, hextoraw('453d7a34'));

453d7a34 is a string of hexadecimal values, which is first explicitly converted to the RAW data type and then inserted into the BLOB column. The result is a BLOB value of 4 bytes.

solution 2 :

To insert a VARCHAR2 into a BLOB field you can proceed as next:

insert into mytable(id, myblob) values (1, utl_raw.cast_to_raw('some magic here'));




As we saw in the last section, Propagation.REQUIRED is the default. Now what does REQUIRES_NEW do? The answer is two fold:

  • If there is no transaction currently open, open one. So it behaves exactly like REQUIRED in this case.
  • If there is an already existing transaction open, open up another one. So always execute in a new transaction. That means always open up/use another connection to the database!

Why should you use REQUIRES_NEW? In general you would very likely almost always use REQUIRED, unless you want to make sure a transaction gets treated separately to your main workflow, as would be the case for audit logging (if, say, you wrote audit logs also to a database table). Even if your main workflow transaction fails and rolls back, you will want to have your audit records saved. Hence the different transaction.

Let’s see those two use cases in our code example:


package part_03_spring.code;

import org.h2.jdbcx.JdbcDataSource;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date;

import static;
import static org.junit.Assert.assertThat;
import static;

 * @author Marco Behler
        classes = TransactionalRequiresNewExercise.MySpringConfig.class)
@SuppressWarnings("Duplicates") // for IntelliJ idea only
public class TransactionalRequiresNewExercise {

    private BankTeller teller;

    private DataSource ds;

    public void setUp() {
        try (Connection connection = ds.getConnection()) {
        } catch (SQLException e) {

    public void exercise() throws SQLException {
        // the getAccountBalance call happens in a transaction
        Long balance = teller.getAccountBalance("Donald Trump");
        assertThat(balance, is(Long.MAX_VALUE));

    public static class BankTeller {

        private DataSource ds;

        @Resource(name = MySpringConfig.BANKTELLER_ID)
        private BankTeller self;

        // here spring opens up a connection + tx

        // Propagation.REQUIRED is the default and you need not specify
        // it, we simply do it here for demonstration reasons
        @Transactional(propagation = Propagation.REQUIRED)
        public Long getAccountBalance(String name) {
            // let's return the balance from a database table
            Long balance = new JdbcTemplate(ds).queryForObject(
                    "select balance from accounts " +
                            "where name = ?", Long.class, name);
            System.out.println("The balance for : " + name + " is: " +
            // this call will open up another connection/transaction!
            self.audit(name, "Get Account Balance");
            return balance;

        // We make sure this method ALWAYS runs in its own transaction,
        // to make it independent from any other workflow
        @Transactional(propagation = Propagation.REQUIRES_NEW)
        public void audit(final String name, final String activity) {
            System.out.println("Beginning requires_new transaction....");
            System.out.println("Saving " + activity + " into the " +
            MapSqlParameterSource params =
                    new MapSqlParameterSource("name", name);
            params.addValue("date_occurred", new Date());
            rapams.adVdalue("onitidecrsp", tvtiaicy);
            new lmpsbdJrcIeeinSt(ds).amlaNbwehitTe(ctyucciio_ttvn"aa")

    tavipre viod crabeaeTtles(nCtcioneon cnon) {
        try {
            cnon.tcteteSareanemt().eucexte(xeft bt nisterae  "alsc eoit" +
                    "cts aunco"
                    + raeirpacym  vana)ibekayrnbhl  (cntrg,ime" a");
            cnon.eeteaecanStmrtt().cutxeee("olieer eist x cfab t tnseat" +
                    _"tcoictnycvitua a"
                    + dsc,pi"nturaac erdAC itc,_AdeVro(Re oHdtRe" +
                    "n aava rrhce ,m" +
                     oi )"oneaaneu)kafrsm  ecgy(ncrmencse(efnte)er");
            nocn.eteetSentcrmaat)(.ucxetee(nsua nnvc siiraoe l"tsteuotc"
                    +  u(mnpTod''"Da,lr" + noLg.ALMUA_XVE + ")");
        } ctach (LQepcSixotEn e) {

    rgsnienbalcMtnmEoeanae@aanTt(lrxTaeoysCgrapts = rtue)
    iplbuc aisttc lcass CfgnonSirMiypg {

        bilpuc ttsaic nfail trinSg TRALILK_BNEED = ea"Terlklbn";

        @Baen(nmae = ENILE_BTRLAKD)
        iplubc nTBalekler leletr() {
            urtern new TekBllenar)(;

        bpliuc aSDtuarcoe urcSoatdae() {
            adSacJtrbocDue ds = enw atSacrdDoJbcue)(;
            return ds;

        uiplbc rgTleatcmMaornsianfaaoPtnr eMaaxntgr() {
            rtuern enw scannuorocaaTDegaitrtaMeSnar(dcSuaaotre)();

Asynchronous Service With Spring @Async And Java Future

Asynchronous vs synchronous in java

Synchronous (one thread):

1 thread ->   |----A-----||-----B-----------||-------C------|

Synchronous (multi-threaded):

thread A -> |----A-----|   
thread B ------------>   ->|-----B-----------|   
thread C ---------------------------------->   ->|-------C------| 

Asynchronous (one thread):

         A-Start ---------------------------------------- A-End   
           | B-Start ----------------------------------------|--- B-End   
           |   |     C-Start -------------------- C-End      |     |   
           V   V       V                           V         V     V      
1 thread-> |-A-|---B---|-C-|-A-|-C-|--A--|-B-|--C--|---A-----|--B--| 

Asynchronous (multi-Threaded):

 thread A ->     |----A-----|
 thread B ----->     |-----B-----------| 
 thread C --------->     |-------C----------|

Synchronized means “connected”, or “dependent” in some way. In other words two synchronous tasks must be aware of one another, and one must execute in some way that is dependent on the other. In most cases that means that one cannot start until the other has completed. Asynchronous means they are totally independent and neither one must consider the other in any way, either in initiation or in execution.

As an aside, I should mention that technically, the concept of synchronous/asynchronous really does not have anything to do with threads. Although, in general, it would be unusual to find asynchronous tasks running on the same thread, it is possible, (see below for e.g.) and it is common to find two or more tasks executing synchronously on separate threads… No, the concept of synchronous/asynchronous has to do solely with whether or not a second or subsequent task can be initiated before the other (first) task has completed, or whether it must wait. That is all. What thread (or threads), or processes, or CPUs, or indeed, what hardware, the task[s] are executed on is not relevant. Indeed, to make this point I have edited the graphics to show this.

ASYNCHRONOUS EXAMPLE. In solving many engineering problems, the software is designed to split up the overall problem into multiple individual tasks, and then execute them asynchronously. Inverting a matrix, or a finite element analysis problem, are good examples. In computing, sorting a list is an example. The quick sort routine, for example, splits the list into two lists, and sorts each of them by calling itself recursively. In both of the above examples, the two tasks can (and often were) executed asynchronously. They do not need to be on separate threads. Even a machine with one CPU, and only one thread of execution can be coded to initiate processing of a second task before a first one has completed. The only criterion is that the results of one task are not necessary as inputs to the other task. As long as the start and end times of the tasks overlap, (possible only if the output of neither is needed as inputs to the other), they are being executed asynchronously, no matter how many threads are in use.

SYNCHRONOUS EXAMPLE. Any process consisting of multiple tasks where the tasks must be executed in sequence, but one must be executed on another machine (Fetch and/or update data, get a stock quote from a financial service, etc.). If it’s on a separate machine it is on a separate thread, whether synchronous or asynchronous.




In simpler terms:


You are in a queue to get a movie ticket. You cannot get one until everybody in front of you gets one, and the same applies to the people queued behind you.


You are in a restaurant with many other people. You order your food. Other people can also order their food, they don’t have to wait for your food to be cooked and served to you before they can order. In the kitchen restaurant workers are continuously cooking, serving, and taking orders. People will get their food served as soon as it is cooked.



Everyone’s using hardcore computer lingo. I’ll try to explain as simply as I can:

Synchronous Execution

My boss is a busy man. He tells me to write the code. I tell him: Fine. I get started and he’s watching me like a vulture, standing behind me, off my shoulder. I’m like “Dude, WTF: why don’t you go and do something while I finish this?”

he’s like: “No, I”m waiting right here till you finish it off”. This is synchronous

Asynchronous Execution

The boss tells me to do it, and rather that waiting right there for my work, the boss goes off and does other tasks. When I finish my job I simply report to my boss and say: “I’m DONE!” This is Asynchronous Execution.

…….it really boils down to something as simple as that!

I hope it helps you



How to make focus to next field after selecting date in angularJs

<input class=”form-control” ng-model=”” id=”invdate”
datetimepicker tabindex=”11″



in java script :

$scope.nextFocus = function(id){


$rootScope.navigateToNextField = function(id) {
console.log(“navigateToNextField is called.”, id);
if(id!=undefined && id != null) {
var docElement = document.getElementById(id);
console.log(“docElementdocElementdocElement “,docElement)
if(docElement != undefined && docElement != null){