Solved

How can I connect MSACCESS database without dsn and physical address?

Posted on 2003-11-24
3
601 Views
Last Modified: 2008-03-17
for example
I wont give fullpath
DBQ=/myweb/data.mdb
asp example
Set bag=server.CreateObject("ADODB.Connection")
bag.open("DBQ=" & server.MapPath("db\form.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}")

it will be look like this
0
Comment
Question by:orhanbaba
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
kennethxu earned 125 total points
ID: 9815242
try
url = "jdbc:odbc:MS Access Database;DBQ=db\\form.mdb"

But I don't think this will work for jsp because the current directory is the directory where server is started. not you jsp directory. you'll need to use application.getRealPath( "db\\form.mdb" ) to the the full path. So it should be:

String url = "jdbc:odbc:MS Access Database;DBQ=" + application.getRealPath( "db\\form.mdb" )
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9816668
Hi.
if you create a system DSN object to your Database you can use this:

        try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            connection = DriverManager.getConnection("jdbc:odbc:[DSN Name]", "", "");
            statement = connection.createStatement();
        }
        catch(ClassNotFoundException classnotfoundexception)
        {
            System.err.println("Cannot find the database driver classes.");
            System.err.println(classnotfoundexception);
        }
        catch(SQLException sqlexception)
        {
            System.err.println("Cannot connect to this database.");
            System.err.println(sqlexception);
        }

regards
Javier
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9816671
Sorry I didn't read the question properly, :c)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question