谢谢,请问有代码示例吗? |
|
15分 |
import java.sql.*; public class dbtest ...{ public static void main(String[] args) ...{ try ...{ Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance(); String url="jdbc:db2://172.16.123.126:60000/DOL"; String user="dolown"; String password="dolown"; System.out.println("try"); Connection conn= DriverManager.getConnection(url,user,password); System.out.print("Done!OK!!! "); PreparedStatement ps=conn.prepareStatement( "select DEALERMARKET_NAME from TR_EVERYBUSINESS_TOTAL "); ResultSet rs=ps.executeQuery(); while (rs.next()) ...{ System.out.println( "user_no= "+rs.getString( "DEALERMARKET_NAME ")); } conn.close(); }catch(Exception sqle) ...{ System.out.print(sqle); } } } |
这里面有代码例子 |
|
import java.sql.*; public class dbtest ...{ public static void main(String[] args) ...{ try ...{ Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance(); String url="jdbc:db2://172.16.123.126:60000/DOL"; String user="dolown"; String password="dolown"; System.out.println("try"); Connection conn= DriverManager.getConnection(url,user,password); System.out.print("Done!OK!!! "); PreparedStatement ps=conn.prepareStatement( "select DEALERMARKET_NAME from TR_EVERYBUSINESS_TOTAL "); ResultSet rs=ps.executeQuery(); while (rs.next()) ...{ System.out.println( "user_no= "+rs.getString( "DEALERMARKET_NAME ")); } conn.close(); }catch(Exception sqle) ...{ System.out.print(sqle); } } } 那我应该怎么配置driver呢?download下来然后放到环境变量里面吗,远程数据库的服务器上也要配置什么吗? |
|
请帮忙回答一下?
|
|
25分 |
|
谢谢! |