Eclipse Plugin Central

EclipseDatabase - How to get the CHAR() FOR BIT DATA column in java

Anonymous - Jun 16, 2005 - 09:05 AM
Post subject: How to get the CHAR() FOR BIT DATA column in java
Hi,

I am working in a java/ISeries environment and I try to display the informations of the DB2 database.

The prolem is that I have not the value of the columns but an hexa codification. I am using he rs.getString METHOD.

This is my code

try{
// make sure driver exists
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
}catch(Exception e){
System.out.println(e.toString());
}
System.out.println("1. Connection succeed..");
try{
// create a new connection from driver
Connection con = DriverManager.getConnection("jdbc:as400://" + "OEM", "BRT", "TRB");
// create new statement from connection
java.sql.Statement stmt = con.createStatement();
System.out.println("2. create new statement from connection..");
// sql
String sql="SELECT * FROM Library.file FETCH FIRST 10 ROWS ONLY";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
out.println("<tr>" );

out.println("<td>"+rs.getString(1)+"</td>" );
out.println("<td>"+rs.getString(2)+"</td>" );
out.println("<td>"+rs.getString(3)+"</td>" );
out.println("<td>"+rs.getString(4)+"</td>" );
out.println("<td>"+rs.getString(5)+"</td>" );
out.println("</tr>" );
}
and that is the result displayed:

40F5F0F0F9F4404040404040404040 C1 1 0 0
C3C7E2E54040404040404040404040 C1 1 0 0
C3E2E2E54040404040404040404040 C1 1 0 0
C3E4E2E54040404040404040404040 C1 1 0 0
C4D6E2E54040404040404040404040 C1 1 0 0
C8E3E2E54040404040404040404040 C1 1 0 0
D7D3E2E54040404040404040404040 C1 1 0 0
D7D9D6E3D640404040404040404040 C1 1 0 0
D9C5D7D3C1C3C5D4C5D5E340404040 C1 1 0 0
D9D7E2E54040404040404040404040 C1 1 0 0

Can you help me

Thanks
saalkam@gmail.com
Anonymous - Aug 25, 2005 - 05:28 PM
Post subject: Re: How to get the CHAR() FOR BIT DATA column in java
saalkam wrote:
Hi,

I am working in a java/ISeries environment and I try to display the informations of the DB2 database.

The prolem is that I have not the value of the columns but an hexa codification. I am using he rs.getString METHOD.

This is my code

try{
// make sure driver exists
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
}catch(Exception e){
System.out.println(e.toString());
}
System.out.println("1. Connection succeed..");
try{
// create a new connection from driver
Connection con = DriverManager.getConnection("jdbc:as400://" + "OEM", "BRT", "TRB");
// create new statement from connection
java.sql.Statement stmt = con.createStatement();
System.out.println("2. create new statement from connection..");
// sql
String sql="SELECT * FROM Library.file FETCH FIRST 10 ROWS ONLY";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
out.println("<tr>" );

out.println("<td>"+rs.getString(1)+"</td>" );
out.println("<td>"+rs.getString(2)+"</td>" );
out.println("<td>"+rs.getString(3)+"</td>" );
out.println("<td>"+rs.getString(4)+"</td>" );
out.println("<td>"+rs.getString(5)+"</td>" );
out.println("</tr>" );
}
and that is the result displayed:

40F5F0F0F9F4404040404040404040 C1 1 0 0
C3C7E2E54040404040404040404040 C1 1 0 0
C3E2E2E54040404040404040404040 C1 1 0 0
C3E4E2E54040404040404040404040 C1 1 0 0
C4D6E2E54040404040404040404040 C1 1 0 0
C8E3E2E54040404040404040404040 C1 1 0 0
D7D3E2E54040404040404040404040 C1 1 0 0
D7D9D6E3D640404040404040404040 C1 1 0 0
D9C5D7D3C1C3C5D4C5D5E340404040 C1 1 0 0
D9D7E2E54040404040404040404040 C1 1 0 0

Can you help me

Thanks
saalkam@gmail.com

Anonymous - Sep 28, 2005 - 02:46 PM
Post subject: Re: How to get the CHAR() FOR BIT DATA column in java
Anonymous wrote:
saalkam wrote:
Hi,

I am working in a java/ISeries environment and I try to display the informations of the DB2 database.

The prolem is that I have not the value of the columns but an hexa codification. I am using he rs.getString METHOD.

This is my code

try{
// make sure driver exists
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
}catch(Exception e){
System.out.println(e.toString());
}
System.out.println("1. Connection succeed..");
try{
// create a new connection from driver
Connection con = DriverManager.getConnection("jdbc:as400://" + "OEM", "BRT", "TRB");
// create new statement from connection
java.sql.Statement stmt = con.createStatement();
System.out.println("2. create new statement from connection..");
// sql
String sql="SELECT * FROM Library.file FETCH FIRST 10 ROWS ONLY";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
out.println("<tr>" );

out.println("<td>"+rs.getString(1)+"</td>" );
out.println("<td>"+rs.getString(2)+"</td>" );
out.println("<td>"+rs.getString(3)+"</td>" );
out.println("<td>"+rs.getString(4)+"</td>" );
out.println("<td>"+rs.getString(5)+"</td>" );
out.println("</tr>" );
}
and that is the result displayed:

40F5F0F0F9F4404040404040404040 C1 1 0 0
C3C7E2E54040404040404040404040 C1 1 0 0
C3E2E2E54040404040404040404040 C1 1 0 0
C3E4E2E54040404040404040404040 C1 1 0 0
C4D6E2E54040404040404040404040 C1 1 0 0
C8E3E2E54040404040404040404040 C1 1 0 0
D7D3E2E54040404040404040404040 C1 1 0 0
D7D9D6E3D640404040404040404040 C1 1 0 0
D9C5D7D3C1C3C5D4C5D5E340404040 C1 1 0 0
D9D7E2E54040404040404040404040 C1 1 0 0

Can you help me

Thanks
saalkam@gmail.com

Anonymous - Nov 22, 2005 - 09:49 PM
Post subject: Re: How to get the CHAR() FOR BIT DATA column in java
saalkam wrote:
Hi,

I am working in a java/ISeries environment and I try to display the informations of the DB2 database.

The prolem is that I have not the value of the columns but an hexa codification. I am using he rs.getString METHOD.

This is my code

try{
// make sure driver exists
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
}catch(Exception e){
System.out.println(e.toString());
}
System.out.println("1. Connection succeed..");
try{
// create a new connection from driver
Connection con = DriverManager.getConnection("jdbc:as400://" + "OEM", "BRT", "TRB");
// create new statement from connection
java.sql.Statement stmt = con.createStatement();
System.out.println("2. create new statement from connection..");
// sql
String sql="SELECT * FROM Library.file FETCH FIRST 10 ROWS ONLY";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
out.println("<tr>" );

out.println("<td>"+rs.getString(1)+"</td>" );
out.println("<td>"+rs.getString(2)+"</td>" );
out.println("<td>"+rs.getString(3)+"</td>" );
out.println("<td>"+rs.getString(4)+"</td>" );
out.println("<td>"+rs.getString(5)+"</td>" );
out.println("</tr>" );
}
and that is the result displayed:

40F5F0F0F9F4404040404040404040 C1 1 0 0
C3C7E2E54040404040404040404040 C1 1 0 0
C3E2E2E54040404040404040404040 C1 1 0 0
C3E4E2E54040404040404040404040 C1 1 0 0
C4D6E2E54040404040404040404040 C1 1 0 0
C8E3E2E54040404040404040404040 C1 1 0 0
D7D3E2E54040404040404040404040 C1 1 0 0
D7D9D6E3D640404040404040404040 C1 1 0 0
D9C5D7D3C1C3C5D4C5D5E340404040 C1 1 0 0
D9D7E2E54040404040404040404040 C1 1 0 0

Can you help me

Thanks
saalkam@gmail.com

All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits