java连接达梦数据库的简单代码
1. 引用DmJdbcDriver.jar包
2. 编写代码:
String driver= "dm.jdbc.driver.DmDriver"; String url= "jdbc:dm://192.168.1.100:12345/TEST"; String username="DEVELOPER"; String password="123456"; Class.forName(driver); Connection conn = DriverManager.getConnection(url, username, password); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select * from OaUser"); int newID = 1; if (rs.next()) { String userName = rs.getString("UserName"); out.println("userName:" +userName); }else{ out.println("no data"); } rs.close(); conn.close();