Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access 7.1.243
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Cobol 5.0.242
  HXTT DBF 7.1.243
  HXTT Excel 6.1.246
  HXTT Json 1.0.214
  HXTT Paradox 7.1.242
  HXTT PDF 2.0.242
  HXTT Text(CSV) 7.1.242
  HXTT Word 1.1.242
  HXTT XML 4.0.243
Offshore Outsourcing
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)

HXTT ACCESS
Access with jdbc to Ms Access with embedded connection
Stefano
2005-11-29 00:00:00
Hello,
I'm developing a jsp web site and i connect the jsp pages to a Ms Access db with java bean. The database it is located in the same directory where is placed the java bean. I would like to know which string i have to pass to the method DriverManager.getConnection() to refer to the database in local. For example "../sql/..../file_name.extension" using html to tell to the browser to do this action:
1- cd..
2- cd sql
3- open file_name.extension.
I'm using tomcat but i can't use a poolable connection because i can't access to the conf file of tomcat.

Sorry for my english.

Thanks, Stefano.
Re:Access with jdbc to Ms Access with embedded connection
HXTT Support
2005-11-29 00:00:00
You can use "jdbc:access:///../sql/file_name.mdb" or "jdbc:access:///"+request.getRealPath("../")+"/sql/file_name.mdb".
Re:Re:Access with jdbc to Ms Access with embedded connection
Stefano
2005-11-29 00:00:00
Thanks for your fast reply. The first method doesnt't work and the second method works but only in Tomcat. I have to put this method in a javabean, a java class compilated that it is used by the jsp pages to connect to the db. In a java class i can't use the method request.getRealPath. I need a corresponding method for java that i can use in a java environment like Eclipse.

Thanks, Stefano
Re:Re:Access with jdbc to Ms Access with embedded connection
Stefano
2005-11-29 00:00:00
Thanks for your fast reply. The first method doesnt't work and the second method works but only in Tomcat. I have to put this method in a javabean, a java class compilated that it is used by the jsp pages to connect to the db. In a java class i can't use the method request.getRealPath. I need a corresponding method for java that i can use in a java environment like Eclipse.

Thanks, Stefano
Re:Re:Re:Re:Access with jdbc to Ms Access with embedded connection
HXTT Supports
2005-11-29 00:00:00
If you know an absolute path, you can use:
"jdbc:access:///c:/aDirectory/../sql/file_name.mdb" for Windows
Or
"jdbc:access:////sys/data/sql/file_name.mdb" for Linux/Unix's sys volumn.

a relative sample:
"jdbc:access:///./../sql/file_name.mdb"

sorry, but I do not solve the problem
Stefano
2006-02-22 00:00:00
Here it's the string that i use in my jsp file:
String urlDb = "jdbc:Access:///./../../db/database.mdb";

The file prova.jsp is in the follow absolute path:
C:\Programmi\Apache Group\Tomcat 4.1\webapps\prova22\jsp\italiano
and the database.mdb is in the follow absolute path:
C:\Programmi\Apache Group\Tomcat 4.1\webapps\prova22\db.

The message that reply tomcat is:
javax.servlet.ServletException: ./../../db/database.mdb doesn't exist!

It is very important that i can't use the method getRealPath() and I must use relative and not absolute path. Thanks very much
Re:Re:Re:Re:Re:Re:Access with jdbc to Ms Access with embedded connection
HXTT Support
2006-02-22 00:00:00
You can use System.out.println(new java.io.File("./../../db/database.mdb").getAbsolutePath());
to see where's that path.
reply
stefano
2006-02-22 00:00:00
i can't use getAbsolutePaht() on the server that hosts my jsp web site
Re:Re:Re:Re:Re:Re:Re:Re:Access with jdbc to Ms Access with embedded connection
HXTT Support
2006-02-22 00:00:00
You can use getClass().getResource("../..").toString() to get a relative path from classpath for your java bean.

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap