Problem and its Solution in SQL Query: How to solve If database table field is blank or null then replace or fill it with zero (0) or one (1) without using if condition in query||Solution procedure of if field = blank or Null then field =0 or 1

sql query

Have you ever faced a problem while using SQL Query in your software where you have to replace the blank or null field in database table with “0”  or  “1”  but  you are  unable to use “If condition” in the sql?

Here I have got a solution where you can replace  or fill the blank or null table data with “0” or “1” by using COALESCE   in SQL query.

Let us assume we have a table called “ITEM”   and it has four fields named “ order_no”, “item_no”, “qty” and  “style_sample_no” . In the field “style_sample_no” there is no data i.e.  this filed is blank/null or empty.

  Read more of this post

Java Xml file to Jasper converter : How to convert Xml file into Jasper in Java using jasper-compiler, jasper-runtime and jasper_bundle||Source code example included.

xml to jasper javaFor the reporting purpose sometimes we may need to convert xml file into jasper.

Here I have tried to show you the conversion procedure of xml file to jasper file using Java Programming Language.

To do this you need the following jar (drivers actually) files

1. jasper-compiler.jar
2. jasper-runtime.jar
3. jasper_bundle.jar

Below, I have attached the Java Source Code of XML to JASPER Converter, Code to compile and run the source code. Also I have included an Image to show you the whole procedure.

Read more of this post

Solution of Batch entry 0 insert into postgresql database table, Call getNextException to see the cause|| Learn How to solve this exception or error ||Java PostgreSQL Database Exception.

sun javaHave you ever faced this exception while executing sql query in  your software  or  database?? Well, I am using  Java programming language in the front end and PostGreSQL in the backend i.e. server side. Recently I have faced the following  exception which was showing actually from the database. I searched internet for the solution but didn’t get any reliable solution. But at last I have solved it and sharing the solution procedure with you. Hope it will also work with your problem

Here is the problem (Exception)

Batch entry 0 insert into endproduct_mat_req(item_no,end_product_mat_no,mat_no,qty) values(523,71,44,100000.0) was aborted.  Call getNextException to see the cause

Read more of this post

Java HashMap Key Set to String ,Array or Vector Convert: Use multiple type (String or Integer) data together as Key Value|| Procedure to retrieve (show) or get individual values from the multiple data type Hash Map key by splitting or breaking || next convert the key into vector.

hashmap key to vector or string array

After a long time I am sharing a post related to Java Programming language. Recently, I have faced a problem while coding   on java HashMap key value set on my job. In my last post I have shown How to show Java HashMap Key value pair and work on it. But the problem I have faced is to convert the Key value set to Vector or String. I used two (2) integer type data, separated with colon, as the key value of my HashMap.  What I need to convert that colon separated key values to individual integer and then convert them or stored them on Vector.

The program given below will show you how to solve such situation.

Read more of this post

JButton in JTable Cell: How to add, assign or fill up JTable’s Cell with JButton and then add ActionListener to enable Click event for that JButtons in JTable cell.

JButton in JTable cellSometimes while working with software using java programming language we may face problem while working with JTable. In JTable Cell you may need to show JButton for various purposes. So, to show JButton in JTable Cell or to fill up JTable’s Column with JButton you will need to use ButtonRenderer and ButtonEditor and to add Click Event on the JButton in JTable cell you will need to add ActionListener for that JButton.

Just Copy the code Below and run it and change it according to your need.

Read more of this post

JTable Cell Empty Validation: How to check or know JTable cell is empty or not and also avoid null or space entry validation in JTable cell before saving JTable data in Database

JTable empty cell validation While designing or preparing  software you may face problem  to check  JTable cell is empty or not while entering JTable data in Database. Another thing may happen, suppose you are trying to validate your JTable cell empty or not but it is taking space or null entry as a string and your empty cell validation may not work. Here I am sharing you a little but useful technique by which you will be able to check your empty JTable cell and also if you enter space in the JTable cell it will catch this cell as empty and will show error. Just run the given program and check how it works.

  Read more of this post

Java English to Bengali (Bangla) Dictionary: How to read or search Bengali word from a file or notepad and then show it in JTextField.

English to bengali dictionary javaToday I am sharing with you another important topic where I will give you an example by which you will get a clear idea about how to read or search any Bengali or Bangla font from a text pad (notepad) or file and then show it in JTextField. This code is important for those who are trying to prepare English to Bengali Dictionary. Download the reader.txt which I have used here to read Bengali (Bangla) words.

Copy the following code and run it by keeping reader.txt in the same folder.

Java Vector Numeric value and SQL Query: How to use Numeic or integer values of a vector in SQL and also how to execute them.

use Vector numeric or integer  value in sql using javaSometimes we may need to use the value of a vector mainly the integer or numeric value in SQL to execute a query . Suppose you have a vector named   studentAge which contains two numeric value for example: [10,12]. Now, if you want to use these two vectors in the SQL to for query execution then you have to write the query as given below.

String sql=”select student_name from student where student_age in (” + studentAge .toString().substring(1, studentAge.toString().lastIndexOf(“]”))+”) and student_class =”+student-class;

Just You have to use the following line

(” + studentAge.toString().substring(1, studentAge.toString().lastIndexOf(“]”))+”)


Read more of this post

Java HashMap Key Value Pair: How to show the Key Value pair data of HashMap.

hashmap key value pair data javaSometimes in java while we do coding and use HashMap we may need to check or see the values reside in Key and their corresponding Data or Values at the same time. Here I am sharing you another simple but useful technique to see the key value pair data of HashMap at a time. Just copy the code below and run it on your computer.

Read more of this post

Java break string in into individual words: How to split a string according to space,comma, colon and more between them and then save it in an array of string.

split string into words and string manipulationToday I am sharing you another basic but important technique about string manipulation. While coding in java, sometimes we need to split or break a string into individual word according to space, commas, colon or any other character between them and then save that individual words into an array of string.

The coding is simple and you can test it according to your need. Just copy the code below and run it in your own machine. Please give comments if this solution is helpful for you.

Read more of this post

%d bloggers like this: