Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Cobol v2.1
  HXTT DBF v5.2
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
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
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT ACCESS
Access with jdbc to Ms Access with embedded connection
Stefano
2005-11-29 00:00:00.0
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.0
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.0
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.0
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.0
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.0
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.0
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.0
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.0
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
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap