| 订阅 | 在线投稿
分享
 
 
 

java:使用路径访问Access数据库

来源:互联网网民  宽屏版  评论
2008-06-01 01:14:32

public class Query{

String url,classname;

Connection conn;

public Query() throws ClassNotFoundException,SQLException{

//Specify the database path to connect

String soFTPath=(new File("")).getAbosultePath();

//String softPath="D:\\myProject";

String dbPath=softPath+"\\dbpath\\dbFile.mdb";

url="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+dbPath;

classname="sun.jdbc.odbc.JdbcOdbcDriver";

Class.forName(classname);

conn=DriverManager.getConnection(url,"newWord","newword");

}

 
特别声明:以上内容(如有图片或视频亦包括在内)为网络用户发布,本站仅提供信息存储服务。
 
public class Query{ String url,classname; Connection conn; public Query() throws ClassNotFoundException,SQLException{ //Specify the database path to connect String soFTPath=(new File("")).getAbosultePath(); //String softPath="D:\\myProject"; String dbPath=softPath+"\\dbpath\\dbFile.mdb"; url="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+dbPath; classname="sun.jdbc.odbc.JdbcOdbcDriver"; Class.forName(classname); conn=DriverManager.getConnection(url,"newWord","newword"); }
󰈣󰈤
 
 
 
>>返回首页<<
 
 热帖排行
 
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有