- - PR -
SWT3.0.1 + JDBC でConnectionを取得できません
1
| 投稿者 | 投稿内容 |
|---|---|
|
投稿日時: 2005-02-21 19:02
はじめまして。 SWTでDB操作を行うアプリを作成しているのですが、 DB2のJDBCを利用してConnectionをとるときに、エラーが起こってしまいます。 普通のクラスで同じ処理を行うと問題ないので、 SWT上で処理をしていることが問題だと思うのですが・・・ どなたかご存知の方がいらっしゃいましたら、教えていただけませんか? ソース: public class Testtest extends Composite { public static void main(String[] args) { org.eclipse.swt.widgets.Display display = Display.getDefault(); org.eclipse.swt.widgets.Shell shell = new Shell(display); shell.setLayout(new org.eclipse.swt.layout.FillLayout()); shell.setSize(new org.eclipse.swt.graphics.Point(300,200)); Testtest thisClass = new Testtest(shell, SWT.NONE); shell.open(); thisClass.h(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep (); } display.dispose(); } public Testtest(Composite parent, int style) { super(parent, style); initialize(); } private void initialize() { setSize(new org.eclipse.swt.graphics.Point(300,200)); } public void h() { Connection con = null; try { Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); con = DriverManager.getConnection("jdbc:db2:xx", "xx", "xx"); ※ここでSQLExceptionが投げられます。 con.close(); } catch (Exception e) { e.printStackTrace(); return; } } } エラー: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(Unknown Source) SQLExceptionではかれるSQLState: 08001(アプリケーション・リクエスターが接続を確立できません。) 実行環境: WINDOWS XP SP1 Eclipse3.0.1から、JavaBeansを実行 DB: DB2 Version 7 (ドライバ:JDBC2.0) |
1
