| |
作者:sonymusic email: sonymusic@china.com //这个例子,是从sun的站点上找来的。当时也找了好久啊。呵呵! // accepts sql statments thru command line import java.sql.*; import java.util.*; public class test { public static void main(string args[]){
try {
class.forname("sun.jdbc.odbc.jdbcodbcdriver"); properties prop = new properties(); prop.put("user", ""); prop.put("password",""); prop.put("charset","gb2312");
connection conn=drivermanager.getconnection("jdbc:odbc:chinese",prop); statement stmt=conn.createstatement(); stmt.execute(args[0]);
}
catch(classnotfoundexception e) { // joptionpane.showmessagedialog(null,"unable to load the driver class","login message", joptionpane.error_message);
} catch(sqlexception e) { e.printstacktrace(); system.out.println(e.geterrorcode()); }
} }
|
|