Fetch oracle data VARCHAR2(N BYTE) return blank string in JAVA …SOLVED
up vote
0
down vote
favorite
I would like to know what's going on when, I'm trying to fetch data from ORACLE database. The datatype of the column is VARCHAR2(40 BYTE) NOT NULL ENABLE.
From @Thoma advise in comment section I've changed the pics into text.
In SQL DEVELOPPER, I have the following result
SELECT ZONE_DESC FROM IC_RATE_ZONES;
"ZONE_DESC"
VIRGIN ISLANDS UK
VIRGIN ISLANDS US
WALLIS AND FUTUNA IS
YEMEN
ZAMBIA
ZAMBIA MOBILE
And when i've tried to fetch those data in JAVA code :
try{
con = conn.getOracle();
stm = con.createStatement();
Rs = stm.executeQuery("select ZONE_DESC FROM IC_RATE_ZONES");
while(Rs.next()){
System.out.println(Rs.getString("ZONE_DESC"));
}
} catch(Exception e){
e.printStackTrace();
}
I get a blank result in my console output.
thanks for your help.
java oracle fetch varchar2
|
show 16 more comments
up vote
0
down vote
favorite
I would like to know what's going on when, I'm trying to fetch data from ORACLE database. The datatype of the column is VARCHAR2(40 BYTE) NOT NULL ENABLE.
From @Thoma advise in comment section I've changed the pics into text.
In SQL DEVELOPPER, I have the following result
SELECT ZONE_DESC FROM IC_RATE_ZONES;
"ZONE_DESC"
VIRGIN ISLANDS UK
VIRGIN ISLANDS US
WALLIS AND FUTUNA IS
YEMEN
ZAMBIA
ZAMBIA MOBILE
And when i've tried to fetch those data in JAVA code :
try{
con = conn.getOracle();
stm = con.createStatement();
Rs = stm.executeQuery("select ZONE_DESC FROM IC_RATE_ZONES");
while(Rs.next()){
System.out.println(Rs.getString("ZONE_DESC"));
}
} catch(Exception e){
e.printStackTrace();
}
I get a blank result in my console output.
thanks for your help.
java oracle fetch varchar2
3
Instead of posting images you might want to post at least your code in properly formatted text form. This makes it easier to preserve (images can get deleted) and work with - and it shows some effort on your part.
– Thomas
Nov 21 at 12:25
@Thomas, sorry for this. this is a remote host and I cannot copy it because of the restriction. I'll try to write it all and post the text later.
– kizawa tomaru
Nov 21 at 12:26
What did you expect on the console? You add data to your model but you do not log the actual data to the console. TrySystem.out.print(Rs.getString(1))
– Vall0n
Nov 21 at 12:28
1
Is there any chance that the code you execute isn't the code you see?
– Thomas
Nov 21 at 12:32
1
Well, not sure if it helps..bjurr.com/jdbc-problem-resultset-getstring-returns-nothing
– secret super star
Nov 21 at 13:31
|
show 16 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I would like to know what's going on when, I'm trying to fetch data from ORACLE database. The datatype of the column is VARCHAR2(40 BYTE) NOT NULL ENABLE.
From @Thoma advise in comment section I've changed the pics into text.
In SQL DEVELOPPER, I have the following result
SELECT ZONE_DESC FROM IC_RATE_ZONES;
"ZONE_DESC"
VIRGIN ISLANDS UK
VIRGIN ISLANDS US
WALLIS AND FUTUNA IS
YEMEN
ZAMBIA
ZAMBIA MOBILE
And when i've tried to fetch those data in JAVA code :
try{
con = conn.getOracle();
stm = con.createStatement();
Rs = stm.executeQuery("select ZONE_DESC FROM IC_RATE_ZONES");
while(Rs.next()){
System.out.println(Rs.getString("ZONE_DESC"));
}
} catch(Exception e){
e.printStackTrace();
}
I get a blank result in my console output.
thanks for your help.
java oracle fetch varchar2
I would like to know what's going on when, I'm trying to fetch data from ORACLE database. The datatype of the column is VARCHAR2(40 BYTE) NOT NULL ENABLE.
From @Thoma advise in comment section I've changed the pics into text.
In SQL DEVELOPPER, I have the following result
SELECT ZONE_DESC FROM IC_RATE_ZONES;
"ZONE_DESC"
VIRGIN ISLANDS UK
VIRGIN ISLANDS US
WALLIS AND FUTUNA IS
YEMEN
ZAMBIA
ZAMBIA MOBILE
And when i've tried to fetch those data in JAVA code :
try{
con = conn.getOracle();
stm = con.createStatement();
Rs = stm.executeQuery("select ZONE_DESC FROM IC_RATE_ZONES");
while(Rs.next()){
System.out.println(Rs.getString("ZONE_DESC"));
}
} catch(Exception e){
e.printStackTrace();
}
I get a blank result in my console output.
thanks for your help.
java oracle fetch varchar2
java oracle fetch varchar2
edited Nov 21 at 14:42
asked Nov 21 at 12:23
kizawa tomaru
186
186
3
Instead of posting images you might want to post at least your code in properly formatted text form. This makes it easier to preserve (images can get deleted) and work with - and it shows some effort on your part.
– Thomas
Nov 21 at 12:25
@Thomas, sorry for this. this is a remote host and I cannot copy it because of the restriction. I'll try to write it all and post the text later.
– kizawa tomaru
Nov 21 at 12:26
What did you expect on the console? You add data to your model but you do not log the actual data to the console. TrySystem.out.print(Rs.getString(1))
– Vall0n
Nov 21 at 12:28
1
Is there any chance that the code you execute isn't the code you see?
– Thomas
Nov 21 at 12:32
1
Well, not sure if it helps..bjurr.com/jdbc-problem-resultset-getstring-returns-nothing
– secret super star
Nov 21 at 13:31
|
show 16 more comments
3
Instead of posting images you might want to post at least your code in properly formatted text form. This makes it easier to preserve (images can get deleted) and work with - and it shows some effort on your part.
– Thomas
Nov 21 at 12:25
@Thomas, sorry for this. this is a remote host and I cannot copy it because of the restriction. I'll try to write it all and post the text later.
– kizawa tomaru
Nov 21 at 12:26
What did you expect on the console? You add data to your model but you do not log the actual data to the console. TrySystem.out.print(Rs.getString(1))
– Vall0n
Nov 21 at 12:28
1
Is there any chance that the code you execute isn't the code you see?
– Thomas
Nov 21 at 12:32
1
Well, not sure if it helps..bjurr.com/jdbc-problem-resultset-getstring-returns-nothing
– secret super star
Nov 21 at 13:31
3
3
Instead of posting images you might want to post at least your code in properly formatted text form. This makes it easier to preserve (images can get deleted) and work with - and it shows some effort on your part.
– Thomas
Nov 21 at 12:25
Instead of posting images you might want to post at least your code in properly formatted text form. This makes it easier to preserve (images can get deleted) and work with - and it shows some effort on your part.
– Thomas
Nov 21 at 12:25
@Thomas, sorry for this. this is a remote host and I cannot copy it because of the restriction. I'll try to write it all and post the text later.
– kizawa tomaru
Nov 21 at 12:26
@Thomas, sorry for this. this is a remote host and I cannot copy it because of the restriction. I'll try to write it all and post the text later.
– kizawa tomaru
Nov 21 at 12:26
What did you expect on the console? You add data to your model but you do not log the actual data to the console. Try
System.out.print(Rs.getString(1))– Vall0n
Nov 21 at 12:28
What did you expect on the console? You add data to your model but you do not log the actual data to the console. Try
System.out.print(Rs.getString(1))– Vall0n
Nov 21 at 12:28
1
1
Is there any chance that the code you execute isn't the code you see?
– Thomas
Nov 21 at 12:32
Is there any chance that the code you execute isn't the code you see?
– Thomas
Nov 21 at 12:32
1
1
Well, not sure if it helps..bjurr.com/jdbc-problem-resultset-getstring-returns-nothing
– secret super star
Nov 21 at 13:31
Well, not sure if it helps..bjurr.com/jdbc-problem-resultset-getstring-returns-nothing
– secret super star
Nov 21 at 13:31
|
show 16 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
THANKS A LOT FOR EVERYONE THAT take the time to answer it. the solution has been mentionned by @secretsuperstar in the comment section but i've do it wrong the first time.
https://bjurr.com/jdbc-problem-resultset-getstring-returns-nothing/
It have to get the ASCII first and read it. The datatype made it complicated.
here is the final result :
try{
con = conn.getOracle();
stm = con.createStatement();
Rs = stm.executeQuery("select ZONE_DESC FROM IC_RATE_ZONES");
while(Rs.next()){
String str = new String();
InputStreamReader in = new InputStreamReader(Rs.getAsciiStream("ZONE_DESC"));
while(in.ready()){
str = str + (char)in.read();
}
System.out.println(str);
}
} catch(Exception e){
e.printStackTrace();
}
thank you all. HOPE IT HELP SOMEONE ELSE
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
THANKS A LOT FOR EVERYONE THAT take the time to answer it. the solution has been mentionned by @secretsuperstar in the comment section but i've do it wrong the first time.
https://bjurr.com/jdbc-problem-resultset-getstring-returns-nothing/
It have to get the ASCII first and read it. The datatype made it complicated.
here is the final result :
try{
con = conn.getOracle();
stm = con.createStatement();
Rs = stm.executeQuery("select ZONE_DESC FROM IC_RATE_ZONES");
while(Rs.next()){
String str = new String();
InputStreamReader in = new InputStreamReader(Rs.getAsciiStream("ZONE_DESC"));
while(in.ready()){
str = str + (char)in.read();
}
System.out.println(str);
}
} catch(Exception e){
e.printStackTrace();
}
thank you all. HOPE IT HELP SOMEONE ELSE
add a comment |
up vote
0
down vote
THANKS A LOT FOR EVERYONE THAT take the time to answer it. the solution has been mentionned by @secretsuperstar in the comment section but i've do it wrong the first time.
https://bjurr.com/jdbc-problem-resultset-getstring-returns-nothing/
It have to get the ASCII first and read it. The datatype made it complicated.
here is the final result :
try{
con = conn.getOracle();
stm = con.createStatement();
Rs = stm.executeQuery("select ZONE_DESC FROM IC_RATE_ZONES");
while(Rs.next()){
String str = new String();
InputStreamReader in = new InputStreamReader(Rs.getAsciiStream("ZONE_DESC"));
while(in.ready()){
str = str + (char)in.read();
}
System.out.println(str);
}
} catch(Exception e){
e.printStackTrace();
}
thank you all. HOPE IT HELP SOMEONE ELSE
add a comment |
up vote
0
down vote
up vote
0
down vote
THANKS A LOT FOR EVERYONE THAT take the time to answer it. the solution has been mentionned by @secretsuperstar in the comment section but i've do it wrong the first time.
https://bjurr.com/jdbc-problem-resultset-getstring-returns-nothing/
It have to get the ASCII first and read it. The datatype made it complicated.
here is the final result :
try{
con = conn.getOracle();
stm = con.createStatement();
Rs = stm.executeQuery("select ZONE_DESC FROM IC_RATE_ZONES");
while(Rs.next()){
String str = new String();
InputStreamReader in = new InputStreamReader(Rs.getAsciiStream("ZONE_DESC"));
while(in.ready()){
str = str + (char)in.read();
}
System.out.println(str);
}
} catch(Exception e){
e.printStackTrace();
}
thank you all. HOPE IT HELP SOMEONE ELSE
THANKS A LOT FOR EVERYONE THAT take the time to answer it. the solution has been mentionned by @secretsuperstar in the comment section but i've do it wrong the first time.
https://bjurr.com/jdbc-problem-resultset-getstring-returns-nothing/
It have to get the ASCII first and read it. The datatype made it complicated.
here is the final result :
try{
con = conn.getOracle();
stm = con.createStatement();
Rs = stm.executeQuery("select ZONE_DESC FROM IC_RATE_ZONES");
while(Rs.next()){
String str = new String();
InputStreamReader in = new InputStreamReader(Rs.getAsciiStream("ZONE_DESC"));
while(in.ready()){
str = str + (char)in.read();
}
System.out.println(str);
}
} catch(Exception e){
e.printStackTrace();
}
thank you all. HOPE IT HELP SOMEONE ELSE
answered Nov 21 at 14:14
kizawa tomaru
186
186
add a comment |
add a comment |
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%2f53411959%2ffetch-oracle-data-varchar2n-byte-return-blank-string-in-java-solved%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
3
Instead of posting images you might want to post at least your code in properly formatted text form. This makes it easier to preserve (images can get deleted) and work with - and it shows some effort on your part.
– Thomas
Nov 21 at 12:25
@Thomas, sorry for this. this is a remote host and I cannot copy it because of the restriction. I'll try to write it all and post the text later.
– kizawa tomaru
Nov 21 at 12:26
What did you expect on the console? You add data to your model but you do not log the actual data to the console. Try
System.out.print(Rs.getString(1))– Vall0n
Nov 21 at 12:28
1
Is there any chance that the code you execute isn't the code you see?
– Thomas
Nov 21 at 12:32
1
Well, not sure if it helps..bjurr.com/jdbc-problem-resultset-getstring-returns-nothing
– secret super star
Nov 21 at 13:31