[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2003-11-24
3
Medium Priority
?
617 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 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
What monsters are hiding in your child's room? In this article I will share with you a tech horror story that could happen to anyone, along with some tips on how you can prevent it from happening to you.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

649 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