PDA

View Full Version : help me !!!!



linhvn
14-07-2003, 19:59
Toi dang viet chuong trinh dung JSP truy cap vao CSDL SQL 7.0 nhung khi connect vao bang trang JSP thi bao loi la:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified %>

neu co ai biet thi chi giup . co can phai cai lai driver cua SQL khong ? Cam on rat nhieu

P/s : Toi da tao datasource trong ODBC Driver roi

thien_say
03-09-2003, 19:21
Theo như tôi hiêu thì bạn dùng JdbcOdbcBridge để truy cập tới Odbc datasource. Bạn cần phải đảm bảo driver của bạn đã được load để DriverManager có thể sử dụng. Có thể dăng kí bằng system property nhưng theo tôi bạn nên thử load trực tiếp như sau (tôi giả sử tên datasource của bạn là ILOVEYOU):

try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (Exception ex) {}

Connection con = null;
Statement sta = null;
try {
con = DriverManager.getConnection("jdbc:odbc:ILOVEYOU");
/**@todo create your statement and access DB here */
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (con != null) con.close();
}