お世話になります。 Java7u51でDB2を使っていましたがJava8u5をインストールしたら DB2が使えなくなりました。 DB2のコンパイルでクラスがないとのエラーが出ます。 import java.sql.*; import sqlj.runtime.*; import sqlj.runtime.ref.*; #sql iterator ItrPos (String, String); #sql context Myctx; class Test14{ public static void main(String[] args) { String col1 = ""; String col2 = ""; System.out.println("try"); try { Class.forName( "COM.ibm.db2.jdbc.app.DB2Driver" ); System.out.println("try1"); Myctx myctx = new Myctx("jdbc:db2:sample","user1","user1",false); System.out.println("try2"); ItrPos itr; System.out.println("try3"); #sql [myctx] itr = { select col1, col2 from Test1 }; System.out.println("select"); while (itr.endFetch() == false){ #sql { fetch :itr into :col1, :col2 }; System.out.println("fetch"); if(itr.endFetch() == false){ System.out.println(col1 + col2); } } } catch(Exception e) { System.out.println(e); if (e instanceof java.sql.SQLException) { System.out.println("error code: " + ((java.sql.SQLException)(e)).getErrorCode()); } } } }
↧