Jeff:
It works... and answers a few of the minor mysteries. Thanks for
following-up.
Much obliged.
--Bill
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class JDBC_1003 {
public static void main(String[] args) {
Connection con = null;
try {
try {
Class.forName("com.ibm.u2.jdbc.UniJDBCDriver");
}
catch(Exception x){
System.out.println( "Here " + x );
}
String url =
"jdbc:ibm-u2://192.168.0.102/SHIPPING";
String userid =
"ups";
String passWord =
"brown";
con = DriverManager.getConnection(url, userid, passWord);
Statement stmt = con.createStatement();
String sql = "select @ID, NAME, CITY,
STATE from PACKSLIPS.X";
ResultSet rs = stmt.executeQuery(sql);
int i = 1;
while (rs.next()&& i< 6)
{
System.out.println("\nRecord "+ i +" :");
System.out.println("\...@id : \t" + rs.getString(1));
System.out.println("\tNAME :\t" + rs.getString(2));
System.out.println("\tCITY :\t" + rs.getString(3));
System.out.println("\tSTATE :\t" + rs.getString(4));
i++;
}
rs.close();
stmt.close() ;
System.out.println("\n\t*--- QUERY test is done
successful ---*\n");
}
catch (SQLException e ) {
System.out.println(e);
}
finally{
try{
if(con != null)
con.close();
}
catch(Exception ignored){}
}
}
}
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jeff Powell
Sent: Wednesday, March 24, 2010 6:49 PM
To: U2 Users List
Subject: Re: [U2] JDBC - Finally - Hitch
This text was supposed to be strikethrough to indicate that it needs to
be removed since it's declared outside the outer try scope.
On 03/24/2010 05:40 PM, Jeff Powell wrote:
> *Connection* con = DriverManager ...
Should read
> con = DriverManager ...
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users