2

Question is:

String strContent = "Hello Hi How are you ";
byte[] byteConent = strContent.getBytes();

But further I want convert to Blob only in Java program

Because I m working on some script for MySQL DB by default for our application.

Regards, Satish

2 Answers 2

3
 Blob blob = connection.createBlob();
 blob.setBytes(1, bytes);

Where connection is the connection to db object.

Sign up to request clarification or add additional context in comments.

2 Comments

hi, i making script only in simple core java program. Becoz that script when run automatically all the Mysql DB will create. becoz when we working on any java project initially script very much requirement...so that why asking
@user1032427 sorry i dont get qhat you are.trying to say
2
Blob blob=null; 
blob=new SerialBlob(byteContent);

1 Comment

hi, i making script only in simple core java program. Becoz that script when run automatically all the Mysql DB will create.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.