How to create a nested json using collections in java
I am creating a Json format for my nav bar menu and menu items.. i have put some effort and have done some work for one loop but what i want is to be nested json
My database has Data like This
What i want is to create a Json format from this table like this
var data = {
"India":
[
{ "Submenu": "delhi", "link" : "https://www.google.com" },
{ "Submenu": "mumbai", "link" : "https://www.google.com" }
],
"USA":
[
{ "Submenu": "NY", "link" : "https://www.google.com" },
{ "Submenu": "california", "link" : "https://www.google.com" }
],
"England":
[
{ "Submenu": "London", "link" : "https://www.google.com" },
{ "Submenu": "Menchester", "link" : "https://www.google.com" }
],
"logout":
};
Till now i have tried this
LinkedHashMap<Object, Object> lhm = null;
List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
String sql="select menu,submenu and link from table_name";
String name,link;
String str = null;
Gson gson = new Gson();
try {
resultSet = statement.executeQuery(sql);
while(resultSet.next()){
lhm= new LinkedHashMap<Object, Object>();
name= resultSet.getString("submenu");
link= resultSet.getString("link");
lhm.put("submenu", name);
lhm.put("link", link);
list.add(lhm);
str = gson.toJson(list);
}
System.out.println(str);
from this i am getting result like this
[{"submenu":"Delhi","link":"https://www.google.com"},{"submenu":"mumbai","link":"https://www.google.com"},{"submenu":"NY","link":"https://www.google.com"},{"submenu":"California","link":"https://www.google.com"},{"submenu":"London","link":"https://www.google.com"},{"submenu":"Mencherter","link":"https://www.google.com"}]
now i have got the sub menus and there link .. i am facing trouble on linking the submenus to there respective menus .. i am facing issue in looping the data acc to my requirement if anyone of you have any suggestion and idea please help me out
java
add a comment |
I am creating a Json format for my nav bar menu and menu items.. i have put some effort and have done some work for one loop but what i want is to be nested json
My database has Data like This
What i want is to create a Json format from this table like this
var data = {
"India":
[
{ "Submenu": "delhi", "link" : "https://www.google.com" },
{ "Submenu": "mumbai", "link" : "https://www.google.com" }
],
"USA":
[
{ "Submenu": "NY", "link" : "https://www.google.com" },
{ "Submenu": "california", "link" : "https://www.google.com" }
],
"England":
[
{ "Submenu": "London", "link" : "https://www.google.com" },
{ "Submenu": "Menchester", "link" : "https://www.google.com" }
],
"logout":
};
Till now i have tried this
LinkedHashMap<Object, Object> lhm = null;
List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
String sql="select menu,submenu and link from table_name";
String name,link;
String str = null;
Gson gson = new Gson();
try {
resultSet = statement.executeQuery(sql);
while(resultSet.next()){
lhm= new LinkedHashMap<Object, Object>();
name= resultSet.getString("submenu");
link= resultSet.getString("link");
lhm.put("submenu", name);
lhm.put("link", link);
list.add(lhm);
str = gson.toJson(list);
}
System.out.println(str);
from this i am getting result like this
[{"submenu":"Delhi","link":"https://www.google.com"},{"submenu":"mumbai","link":"https://www.google.com"},{"submenu":"NY","link":"https://www.google.com"},{"submenu":"California","link":"https://www.google.com"},{"submenu":"London","link":"https://www.google.com"},{"submenu":"Mencherter","link":"https://www.google.com"}]
now i have got the sub menus and there link .. i am facing trouble on linking the submenus to there respective menus .. i am facing issue in looping the data acc to my requirement if anyone of you have any suggestion and idea please help me out
java
1
Can you please remove all SQL/JDBC related stuff from your code snippet as this is not relevant to your problem. Instead, please provide a short, self contained, correct example (see sscce.org).
– isnot2bad
Nov 26 '18 at 7:55
@isnot2bad i have edited ..now can you help me with solution please
– user10561216
Nov 26 '18 at 8:19
add a comment |
I am creating a Json format for my nav bar menu and menu items.. i have put some effort and have done some work for one loop but what i want is to be nested json
My database has Data like This
What i want is to create a Json format from this table like this
var data = {
"India":
[
{ "Submenu": "delhi", "link" : "https://www.google.com" },
{ "Submenu": "mumbai", "link" : "https://www.google.com" }
],
"USA":
[
{ "Submenu": "NY", "link" : "https://www.google.com" },
{ "Submenu": "california", "link" : "https://www.google.com" }
],
"England":
[
{ "Submenu": "London", "link" : "https://www.google.com" },
{ "Submenu": "Menchester", "link" : "https://www.google.com" }
],
"logout":
};
Till now i have tried this
LinkedHashMap<Object, Object> lhm = null;
List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
String sql="select menu,submenu and link from table_name";
String name,link;
String str = null;
Gson gson = new Gson();
try {
resultSet = statement.executeQuery(sql);
while(resultSet.next()){
lhm= new LinkedHashMap<Object, Object>();
name= resultSet.getString("submenu");
link= resultSet.getString("link");
lhm.put("submenu", name);
lhm.put("link", link);
list.add(lhm);
str = gson.toJson(list);
}
System.out.println(str);
from this i am getting result like this
[{"submenu":"Delhi","link":"https://www.google.com"},{"submenu":"mumbai","link":"https://www.google.com"},{"submenu":"NY","link":"https://www.google.com"},{"submenu":"California","link":"https://www.google.com"},{"submenu":"London","link":"https://www.google.com"},{"submenu":"Mencherter","link":"https://www.google.com"}]
now i have got the sub menus and there link .. i am facing trouble on linking the submenus to there respective menus .. i am facing issue in looping the data acc to my requirement if anyone of you have any suggestion and idea please help me out
java
I am creating a Json format for my nav bar menu and menu items.. i have put some effort and have done some work for one loop but what i want is to be nested json
My database has Data like This
What i want is to create a Json format from this table like this
var data = {
"India":
[
{ "Submenu": "delhi", "link" : "https://www.google.com" },
{ "Submenu": "mumbai", "link" : "https://www.google.com" }
],
"USA":
[
{ "Submenu": "NY", "link" : "https://www.google.com" },
{ "Submenu": "california", "link" : "https://www.google.com" }
],
"England":
[
{ "Submenu": "London", "link" : "https://www.google.com" },
{ "Submenu": "Menchester", "link" : "https://www.google.com" }
],
"logout":
};
Till now i have tried this
LinkedHashMap<Object, Object> lhm = null;
List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
String sql="select menu,submenu and link from table_name";
String name,link;
String str = null;
Gson gson = new Gson();
try {
resultSet = statement.executeQuery(sql);
while(resultSet.next()){
lhm= new LinkedHashMap<Object, Object>();
name= resultSet.getString("submenu");
link= resultSet.getString("link");
lhm.put("submenu", name);
lhm.put("link", link);
list.add(lhm);
str = gson.toJson(list);
}
System.out.println(str);
from this i am getting result like this
[{"submenu":"Delhi","link":"https://www.google.com"},{"submenu":"mumbai","link":"https://www.google.com"},{"submenu":"NY","link":"https://www.google.com"},{"submenu":"California","link":"https://www.google.com"},{"submenu":"London","link":"https://www.google.com"},{"submenu":"Mencherter","link":"https://www.google.com"}]
now i have got the sub menus and there link .. i am facing trouble on linking the submenus to there respective menus .. i am facing issue in looping the data acc to my requirement if anyone of you have any suggestion and idea please help me out
java
java
edited Nov 26 '18 at 8:11
asked Nov 26 '18 at 7:44
user10561216
1
Can you please remove all SQL/JDBC related stuff from your code snippet as this is not relevant to your problem. Instead, please provide a short, self contained, correct example (see sscce.org).
– isnot2bad
Nov 26 '18 at 7:55
@isnot2bad i have edited ..now can you help me with solution please
– user10561216
Nov 26 '18 at 8:19
add a comment |
1
Can you please remove all SQL/JDBC related stuff from your code snippet as this is not relevant to your problem. Instead, please provide a short, self contained, correct example (see sscce.org).
– isnot2bad
Nov 26 '18 at 7:55
@isnot2bad i have edited ..now can you help me with solution please
– user10561216
Nov 26 '18 at 8:19
1
1
Can you please remove all SQL/JDBC related stuff from your code snippet as this is not relevant to your problem. Instead, please provide a short, self contained, correct example (see sscce.org).
– isnot2bad
Nov 26 '18 at 7:55
Can you please remove all SQL/JDBC related stuff from your code snippet as this is not relevant to your problem. Instead, please provide a short, self contained, correct example (see sscce.org).
– isnot2bad
Nov 26 '18 at 7:55
@isnot2bad i have edited ..now can you help me with solution please
– user10561216
Nov 26 '18 at 8:19
@isnot2bad i have edited ..now can you help me with solution please
– user10561216
Nov 26 '18 at 8:19
add a comment |
2 Answers
2
active
oldest
votes
First retrieve required dat from DB:
select menu, sub-menu, link from table_name;
Then create a Map
to hold a menu content:
Map<String, List<Map<String, String>> map = new LinkedHashMap<>();
Then read result sets and fill a map, using menu name as a key:
while(rs.next()) {
map.compute(rs.getString("menu"), (menu, subMenus) -> {
Map<String, String> mapSubMenu = new LinkedHashMap<>();
mapSubMenu.put("Submenu", rs.getString("sub-menu"));
mapSubMenu.put("link", rs.getString("link"));
subMenus = subMenus != null ? subMenus : new ArrayList<>();
subMenus.add(mapSubMenu);
return subMenus;
});
}
subMenus.add(mapSubMenu); here it is showing error "The method add(Map<Object,Object>) is undefined for the type Object" this is the error
– user10561216
Nov 26 '18 at 8:07
See updates. Fixed.
– oleg.cherednik
Nov 26 '18 at 8:27
sir its not giving the right result
– user10561216
Nov 26 '18 at 9:42
Well, I did mot check it because it is mot enough to copy paste your code to do it. Try to use debugger and find out what is wrong. Generally, it looks fine and approach is correct.
– oleg.cherednik
Nov 26 '18 at 9:45
ok sir .. but its not giving me menus only giving me sub menus :(..ok i ll try
– user10561216
Nov 26 '18 at 9:56
add a comment |
Try Using Map<String,List<Map<Object, Object>>>
instead of List<Map<Object, Object>>
so that you can give menu name to your main menu.
LinkedHashMap<Object, Object> lhm; //initiaze
Map<String,List<Map<Object, Object>>> map;
List<Map<Object, Object>> list;
while(rs.next())
{
String menu = rs.getString("menu");
String subMenu = rs.getString("sub-menu");
String link = rs.getString("link");
lhm.put("submenu", name);
lhm.put("link", link);
if (map.containsKey(menu)) //check if mainmenu already present
{
map.get(menu).add(lhm);
}
else
{
//initialize list here
list.add(lhm);
map.put(menu,list);
}
}
str = gson.toJson(list);
Follow idea only and customize code as your need
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53476618%2fhow-to-create-a-nested-json-using-collections-in-java%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
First retrieve required dat from DB:
select menu, sub-menu, link from table_name;
Then create a Map
to hold a menu content:
Map<String, List<Map<String, String>> map = new LinkedHashMap<>();
Then read result sets and fill a map, using menu name as a key:
while(rs.next()) {
map.compute(rs.getString("menu"), (menu, subMenus) -> {
Map<String, String> mapSubMenu = new LinkedHashMap<>();
mapSubMenu.put("Submenu", rs.getString("sub-menu"));
mapSubMenu.put("link", rs.getString("link"));
subMenus = subMenus != null ? subMenus : new ArrayList<>();
subMenus.add(mapSubMenu);
return subMenus;
});
}
subMenus.add(mapSubMenu); here it is showing error "The method add(Map<Object,Object>) is undefined for the type Object" this is the error
– user10561216
Nov 26 '18 at 8:07
See updates. Fixed.
– oleg.cherednik
Nov 26 '18 at 8:27
sir its not giving the right result
– user10561216
Nov 26 '18 at 9:42
Well, I did mot check it because it is mot enough to copy paste your code to do it. Try to use debugger and find out what is wrong. Generally, it looks fine and approach is correct.
– oleg.cherednik
Nov 26 '18 at 9:45
ok sir .. but its not giving me menus only giving me sub menus :(..ok i ll try
– user10561216
Nov 26 '18 at 9:56
add a comment |
First retrieve required dat from DB:
select menu, sub-menu, link from table_name;
Then create a Map
to hold a menu content:
Map<String, List<Map<String, String>> map = new LinkedHashMap<>();
Then read result sets and fill a map, using menu name as a key:
while(rs.next()) {
map.compute(rs.getString("menu"), (menu, subMenus) -> {
Map<String, String> mapSubMenu = new LinkedHashMap<>();
mapSubMenu.put("Submenu", rs.getString("sub-menu"));
mapSubMenu.put("link", rs.getString("link"));
subMenus = subMenus != null ? subMenus : new ArrayList<>();
subMenus.add(mapSubMenu);
return subMenus;
});
}
subMenus.add(mapSubMenu); here it is showing error "The method add(Map<Object,Object>) is undefined for the type Object" this is the error
– user10561216
Nov 26 '18 at 8:07
See updates. Fixed.
– oleg.cherednik
Nov 26 '18 at 8:27
sir its not giving the right result
– user10561216
Nov 26 '18 at 9:42
Well, I did mot check it because it is mot enough to copy paste your code to do it. Try to use debugger and find out what is wrong. Generally, it looks fine and approach is correct.
– oleg.cherednik
Nov 26 '18 at 9:45
ok sir .. but its not giving me menus only giving me sub menus :(..ok i ll try
– user10561216
Nov 26 '18 at 9:56
add a comment |
First retrieve required dat from DB:
select menu, sub-menu, link from table_name;
Then create a Map
to hold a menu content:
Map<String, List<Map<String, String>> map = new LinkedHashMap<>();
Then read result sets and fill a map, using menu name as a key:
while(rs.next()) {
map.compute(rs.getString("menu"), (menu, subMenus) -> {
Map<String, String> mapSubMenu = new LinkedHashMap<>();
mapSubMenu.put("Submenu", rs.getString("sub-menu"));
mapSubMenu.put("link", rs.getString("link"));
subMenus = subMenus != null ? subMenus : new ArrayList<>();
subMenus.add(mapSubMenu);
return subMenus;
});
}
First retrieve required dat from DB:
select menu, sub-menu, link from table_name;
Then create a Map
to hold a menu content:
Map<String, List<Map<String, String>> map = new LinkedHashMap<>();
Then read result sets and fill a map, using menu name as a key:
while(rs.next()) {
map.compute(rs.getString("menu"), (menu, subMenus) -> {
Map<String, String> mapSubMenu = new LinkedHashMap<>();
mapSubMenu.put("Submenu", rs.getString("sub-menu"));
mapSubMenu.put("link", rs.getString("link"));
subMenus = subMenus != null ? subMenus : new ArrayList<>();
subMenus.add(mapSubMenu);
return subMenus;
});
}
edited Nov 26 '18 at 10:57
answered Nov 26 '18 at 7:55
oleg.cherednikoleg.cherednik
7,19521219
7,19521219
subMenus.add(mapSubMenu); here it is showing error "The method add(Map<Object,Object>) is undefined for the type Object" this is the error
– user10561216
Nov 26 '18 at 8:07
See updates. Fixed.
– oleg.cherednik
Nov 26 '18 at 8:27
sir its not giving the right result
– user10561216
Nov 26 '18 at 9:42
Well, I did mot check it because it is mot enough to copy paste your code to do it. Try to use debugger and find out what is wrong. Generally, it looks fine and approach is correct.
– oleg.cherednik
Nov 26 '18 at 9:45
ok sir .. but its not giving me menus only giving me sub menus :(..ok i ll try
– user10561216
Nov 26 '18 at 9:56
add a comment |
subMenus.add(mapSubMenu); here it is showing error "The method add(Map<Object,Object>) is undefined for the type Object" this is the error
– user10561216
Nov 26 '18 at 8:07
See updates. Fixed.
– oleg.cherednik
Nov 26 '18 at 8:27
sir its not giving the right result
– user10561216
Nov 26 '18 at 9:42
Well, I did mot check it because it is mot enough to copy paste your code to do it. Try to use debugger and find out what is wrong. Generally, it looks fine and approach is correct.
– oleg.cherednik
Nov 26 '18 at 9:45
ok sir .. but its not giving me menus only giving me sub menus :(..ok i ll try
– user10561216
Nov 26 '18 at 9:56
subMenus.add(mapSubMenu); here it is showing error "The method add(Map<Object,Object>) is undefined for the type Object" this is the error
– user10561216
Nov 26 '18 at 8:07
subMenus.add(mapSubMenu); here it is showing error "The method add(Map<Object,Object>) is undefined for the type Object" this is the error
– user10561216
Nov 26 '18 at 8:07
See updates. Fixed.
– oleg.cherednik
Nov 26 '18 at 8:27
See updates. Fixed.
– oleg.cherednik
Nov 26 '18 at 8:27
sir its not giving the right result
– user10561216
Nov 26 '18 at 9:42
sir its not giving the right result
– user10561216
Nov 26 '18 at 9:42
Well, I did mot check it because it is mot enough to copy paste your code to do it. Try to use debugger and find out what is wrong. Generally, it looks fine and approach is correct.
– oleg.cherednik
Nov 26 '18 at 9:45
Well, I did mot check it because it is mot enough to copy paste your code to do it. Try to use debugger and find out what is wrong. Generally, it looks fine and approach is correct.
– oleg.cherednik
Nov 26 '18 at 9:45
ok sir .. but its not giving me menus only giving me sub menus :(..ok i ll try
– user10561216
Nov 26 '18 at 9:56
ok sir .. but its not giving me menus only giving me sub menus :(..ok i ll try
– user10561216
Nov 26 '18 at 9:56
add a comment |
Try Using Map<String,List<Map<Object, Object>>>
instead of List<Map<Object, Object>>
so that you can give menu name to your main menu.
LinkedHashMap<Object, Object> lhm; //initiaze
Map<String,List<Map<Object, Object>>> map;
List<Map<Object, Object>> list;
while(rs.next())
{
String menu = rs.getString("menu");
String subMenu = rs.getString("sub-menu");
String link = rs.getString("link");
lhm.put("submenu", name);
lhm.put("link", link);
if (map.containsKey(menu)) //check if mainmenu already present
{
map.get(menu).add(lhm);
}
else
{
//initialize list here
list.add(lhm);
map.put(menu,list);
}
}
str = gson.toJson(list);
Follow idea only and customize code as your need
add a comment |
Try Using Map<String,List<Map<Object, Object>>>
instead of List<Map<Object, Object>>
so that you can give menu name to your main menu.
LinkedHashMap<Object, Object> lhm; //initiaze
Map<String,List<Map<Object, Object>>> map;
List<Map<Object, Object>> list;
while(rs.next())
{
String menu = rs.getString("menu");
String subMenu = rs.getString("sub-menu");
String link = rs.getString("link");
lhm.put("submenu", name);
lhm.put("link", link);
if (map.containsKey(menu)) //check if mainmenu already present
{
map.get(menu).add(lhm);
}
else
{
//initialize list here
list.add(lhm);
map.put(menu,list);
}
}
str = gson.toJson(list);
Follow idea only and customize code as your need
add a comment |
Try Using Map<String,List<Map<Object, Object>>>
instead of List<Map<Object, Object>>
so that you can give menu name to your main menu.
LinkedHashMap<Object, Object> lhm; //initiaze
Map<String,List<Map<Object, Object>>> map;
List<Map<Object, Object>> list;
while(rs.next())
{
String menu = rs.getString("menu");
String subMenu = rs.getString("sub-menu");
String link = rs.getString("link");
lhm.put("submenu", name);
lhm.put("link", link);
if (map.containsKey(menu)) //check if mainmenu already present
{
map.get(menu).add(lhm);
}
else
{
//initialize list here
list.add(lhm);
map.put(menu,list);
}
}
str = gson.toJson(list);
Follow idea only and customize code as your need
Try Using Map<String,List<Map<Object, Object>>>
instead of List<Map<Object, Object>>
so that you can give menu name to your main menu.
LinkedHashMap<Object, Object> lhm; //initiaze
Map<String,List<Map<Object, Object>>> map;
List<Map<Object, Object>> list;
while(rs.next())
{
String menu = rs.getString("menu");
String subMenu = rs.getString("sub-menu");
String link = rs.getString("link");
lhm.put("submenu", name);
lhm.put("link", link);
if (map.containsKey(menu)) //check if mainmenu already present
{
map.get(menu).add(lhm);
}
else
{
//initialize list here
list.add(lhm);
map.put(menu,list);
}
}
str = gson.toJson(list);
Follow idea only and customize code as your need
edited Nov 26 '18 at 10:49
answered Nov 26 '18 at 10:10
TarunTarun
702415
702415
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53476618%2fhow-to-create-a-nested-json-using-collections-in-java%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Can you please remove all SQL/JDBC related stuff from your code snippet as this is not relevant to your problem. Instead, please provide a short, self contained, correct example (see sscce.org).
– isnot2bad
Nov 26 '18 at 7:55
@isnot2bad i have edited ..now can you help me with solution please
– user10561216
Nov 26 '18 at 8:19