f



request for explanation on access an database in ms access

This is the code that I found on the internet for accessing an ms
access database:

import java.sql.*;
class Test


    {
    public static void main(String[] args)


        {


            try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            // set this to a MS Access DB you have on your machine
            String filename = "d:/java/mdbTEST.mdb";
            String database = "jdbc:odbc:Driver={Microsoft Access
Driver (*.mdb)};DBQ=";
            database+= filename.trim() +
";DriverID=22;READONLY=true}"; // add on to the end
            // now we can get the connection from the DriverManager
            Connection con = DriverManager.getConnection( database
,"","");
        }


            catch (Exception e) {
            System.out.println("Error: " + e);
        }
    }
}

What I don't understand is the declaration of database. What I did was
putting the database in the same dir as the sourcecode and use
"jdbc:odbc:CafeJolt.mdb". But this doesn't work. And the above code
does, why is that???
0
piggybing (9)
10/11/2004 11:44:31 PM
comp.lang.java.help 13340 articles. 0 followers. Post Follow

2 Replies
2662 Views

Similar Articles

[PageSpeed] 38

Actually it's not Java question. It's ODBC question.
You have to have ODBC connection. Depending of Windows it's usually
something like this (for my Windows 2000):
Start->Sttings->Control Panel->Administartive Tools->Data Sources(ODBC)->
User DSN -> [Add]-> Driver to Microsoft Access(*.mdb)  === And here, finally
you can choose file name.

I have enough of M$ in real life and try to escape it at least in Java confs
:(((

Alex Kizub.

Madhur Ahuja wrote:

> Jean Paul <piggybing@lycos.nl> wrote:
> > This is the code that I found on the internet for accessing an ms
> > access database:
> >
> > import java.sql.*;
> > class Test
> >
> >
> >     {
> >     public static void main(String[] args)
> >
> >
> >         {
> >
> >
> >             try {
> >             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> >             // set this to a MS Access DB you have on your machine
> >             String filename = "d:/java/mdbTEST.mdb";
> >             String database = "jdbc:odbc:Driver={Microsoft Access
> > Driver (*.mdb)};DBQ=";
> >             database+= filename.trim() +
> > ";DriverID=22;READONLY=true}"; // add on to the end
> >             // now we can get the connection from the DriverManager
> >             Connection con = DriverManager.getConnection( database
> > ,"","");
> >         }
> >
> >
> >             catch (Exception e) {
> >             System.out.println("Error: " + e);
> >         }
> >     }
> > }
> >
> > What I don't understand is the declaration of database. What I did was
> > putting the database in the same dir as the sourcecode and use
> > "jdbc:odbc:CafeJolt.mdb". But this doesn't work. And the above code
> > does, why is that???
>
> Hello
>
> This is not the same thing AFAIK.
>
> First of all, you cannot access the database just with the filename.
> Filename
> is a low level raw thing.
>
> The piece of code above dynamically creates a new DSN for the MS Access
> Database. The name of the driver is clearly specified as
> *Microsoft Access Driver*.
>
> --
> Madhur Ahuja [madhur<underscore>ahuja<at>yahoo<dot>com]
>
> Homepage
> http://madhur.netfirms.com

0
akizub (122)
10/12/2004 1:03:49 AM
Jean Paul <piggybing@lycos.nl> wrote:
> This is the code that I found on the internet for accessing an ms
> access database:
>
> import java.sql.*;
> class Test
>
>
>     {
>     public static void main(String[] args)
>
>
>         {
>
>
>             try {
>             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
>             // set this to a MS Access DB you have on your machine
>             String filename = "d:/java/mdbTEST.mdb";
>             String database = "jdbc:odbc:Driver={Microsoft Access
> Driver (*.mdb)};DBQ=";
>             database+= filename.trim() +
> ";DriverID=22;READONLY=true}"; // add on to the end
>             // now we can get the connection from the DriverManager
>             Connection con = DriverManager.getConnection( database
> ,"","");
>         }
>
>
>             catch (Exception e) {
>             System.out.println("Error: " + e);
>         }
>     }
> }
>
> What I don't understand is the declaration of database. What I did was
> putting the database in the same dir as the sourcecode and use
> "jdbc:odbc:CafeJolt.mdb". But this doesn't work. And the above code
> does, why is that???

Hello

This is not the same thing AFAIK.

First of all, you cannot access the database just with the filename.
Filename
is a low level raw thing.

The piece of code above dynamically creates a new DSN for the MS Access
Database. The name of the driver is clearly specified as
*Microsoft Access Driver*.

--
Madhur Ahuja [madhur<underscore>ahuja<at>yahoo<dot>com]

Homepage
http://madhur.netfirms.com






0
ef (125)
10/12/2004 1:08:58 AM
Reply:

Similar Artilces:

Create MS/ACCESS database app for non-ms/access users
Is it possible to create an MS/ACCESS database application and package it for users who do not have MS/ACCESS loaded in their PCs? I was told that this is possible, but I don't know what software is needed. Do you know? If so, please answer this post. Thanks. SueB *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Per Sue Bricker: >Is it possible to create an MS/ACCESS database application and package >it for users who do not have MS/ACCESS loaded in their PCs? > >I was told that this is possible, but...

MATLAB command to access MS Access database
Hi! Is there a MATLAB command which gives access to a .mdb MS Access database or do I need a special driver? Thanks, Andree Hi Andree Ellert, you can use activeXcontrol to interact with MS-Access database. access = actxserver('Access.Application'); returns the handle for Access. set(access, 'Visible', 1); will show the opened Access window. use get(access) and set(access) commands to find the methods available to call. -Vadivelu M =========== http://www.mathworks.com/access/helpdesk/help/toolbox/database/datatool.shtml "Andree Ellert" <ellert@gmx.net////...

access to MS Access password-protected database?
Can anyone direct me towards a code snippet showing how to use Python to insert data into a password-protected MS Access database? My google searches have been uninformative for dbs that are password-protected. Thanks, Ken On Feb 11, 10:43=A0am, Ken McDonald <kmmcdon...@medicine.wisc.edu> wrote: > Can anyone direct me towards a code snippet showing how to use Python =A0 > to insert data into a password-protected MS Access database? My google = =A0 > searches have been uninformative for dbs that are password-protected. > > Thanks, > Ken You post is a little vague...

Java access to Microsoft Access database through Samba
Hi, I need to access from an JSP application in a Linux server to a Microsoft Access database (only read) that is in another Windows server (only accepts users in its domain, that are different from Linux server users) I have configured Samba so that I can access to the database file. When I access through the folder navigator of Linux it requests me user, domain and password and access without problems. I do not know, how to access from a Java/JSP application, it's possible to do it? what driver I must use? it is necessary to configure Samaba to have permission some user in parti...

Access MS-ACCESS database on server from client????
I m currently developing a java based application and want to know how can i make client access database located on the server? "HeMan_Speaks" <Lunar20092010@gmail.com> wrote in message news:d71ce567-0434-48b8-b1d2-bb191706ab45@w8g2000prd.googlegroups.com... >I m currently developing a java based application and want to know how > can i make client access database located on the server? I think you're going to have to expand a little bit more in your question here, as is not 100% quite clear what you're trying to do. You might want to make a little bit of a d...

Java access to Microsoft Access database through Samba
Hi, I need to access from an JSP application in a Linux server to a Microsoft Access database (only read) that is in another Windows server (only accepts users in its domain, that are different from Linux server users) I have configured Samba so that I can access to the database file. When I access through the folder navigator of Linux it requests me user, domain and password and access without problems. I do not know, how to access from a Java/JSP application, it's possible to do it? what driver I must use? it is necessary to configure Samaba to have permission some user in parti...

Java access to Microsoft Access database through Samba
Hi, I need to access from an JSP application in a Linux server to a Microsoft Access database (only read) that is in another Windows server (only accepts users in its domain, that are different from Linux server users) I have configured Samba so that I can access to the database file. When I access through the folder navigator of Linux it requests me user, domain and password and access without problems. I do not know, how to access from a Java/JSP application, it's possible to do it? what driver I must use? it is necessary to configure Samaba to have permission some user i...

Java access to Microsoft Access database through Samba
Hi, I need to access from an JSP application in a Linux server to a Microsoft Access database (only read) that is in another Windows server (only accepts users in its domain, that are different from Linux server users) I have configured Samba so that I can access to the database file. When I access through the folder navigator of Linux it requests me user, domain and password and access without problems. I do not know, how to access from a Java/JSP application, it's possible to do it? what driver I must use? it is necessary to configure Samaba to have permission...

Any MS Access that is NOT MS Access in WinXP?
Hi all, I have a small application for bookkeeping, actually working in Access with small routines in VBA. I want to rewrite it in Java, but I don't want to use Access anymore. I started looking for another database, but I found none. I already know (and used) MySQL and PostgreSQL (waiting 7.4), but as far as I know they are only daemon, and under windows they use a lot of memory and CPU time. It's like installing a Ferrari only to cross the road. Maybe an approach with loading the daemon at the start of the program, and quitting it at the end, but I don't know how ...

Accessing MS ACCESS database using Data Environment
HI, I have developped a program in Visual Basic 6.0 using MS Access database. I have created all my reports through Data Environment where I have entered the location of my database file (for e.g c:\project\app\test.mdb) in the Connection properties. I have installed my application on another PC using Package & Deployment wizard. When viewing the reports on the other PC, I have to enter everytime the new location of the database. How can I solve this problem, please? nadia wrote: > HI, > I have developped a program in Visual Basic 6.0 using MS Access database. >...

Accessing a MS Access database across two servers
Hi The technical support guys at my company have set up my system so that the server containing the MS Access database is on one server, while the pages that should access the database are on another server. When the pages and database are on the same server, I usually just connect through ODBC. The problem is that I don't know how to set up an ODBC connection to link from one server to a database in another. Anyone know what I am getting at and know of a possible solution, or a link to a site which may help. thanks in advance Brendan "Singularity" <Brendan.Collins@Sin...

Running a ms access database with access 2003 in Vista
I have a Database that I am trying to run on a new vista computer. Up to now I was running it on a win 98 computer and using access 2003! I installed access 2003 and I can make it run and view the data but I can not save any new records. Has any one seen this problem yet? Thanks Clarence Wollman On Wed, 22 Aug 2007 13:17:13 -0700, cwoll <clarencewollman@gmail.com> wrote: Do you have the same problem with the Northwind sample application? (search your computer for northwind.mdb) -Tom. >I have a Database that I am trying to run on a new vista computer. Up >to now I was running...

Redhat Apache to access MS-Access Database through PHP
Hi, I am wondering if anyone knows how to make this work. I have Redhat Liux ES v2.1 Server Apache 1.3 PHP 4.0 a MS-Access MDB file (just the file, already created) The MS-Access file is already in the Redhat Linux server. Is there a way I can make Apache & PHP to access this MS-Access MDB file? Thank you. ...

Wanted
I am wanting to be able to write reports against an ms-access database that is part of another package. I only want to report from the database. What I need is a package that will allow me to create the reports and then be able to distribute a run-time version. The client may not have Office so the package must run standalone. It could get to the Access database through an ODBC driver. Does anyone know what packages available? It looks like Crystal Reports has taken out their runtime version with their latest software but that was only a footnote in a book that I was reading. Please provide...

access MS-Access database in C# Windows Application
Hi, I am trying to access the MS Access database on my local machine in C# Windows Application in Visual Studio.NET. But it seems that it does not work. I use the Microsoft Application Blocks to access the database. I have tried 2 possible connection strings. ----------------------------------------- str_1 = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" + DBFilePath; str_2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DBFilePath; //SqlHelper is the class in the Microsoft Application Blocks SqlHelper.ExecuteNonQuery( str_1, CommandType.Text, SQL_str); --------...

Best way to access a remote MS ACCESS database
What is the best way, via the internet, to access a remote Microsoft Access database? I was thinking of using VPN, but I thought that I would check here to see if there is a better way. Any suggestions? Thanks Do you mean remotely controlling an Access database, or linking tables over the internet? The first is doable, the second is a recipe for disaster. Remote Control: If your remote OS is Windows XP, you can use Remote Desktop (although only 1 person can access the PC at a time; this will change in the upcoming Service Pack for XP, but that may not help you now). Otherwise, GoToMyPC offers similar services, as does Terminal Server (a component of a Windows Server machine), PCAnywhere, et al. Linking to remote tables: You will almost certainly encounter severe problems with corruption, and your performance will almost certainly be so poor as to be unworkable. I attempted this once, with a web server in Canada and my machine in Augusta, GA. Even tiny data requests on a very well optimized data structure took waaaay too long to process ... it's simply not workable, IMO. Other alternatives would be covert the app to a web-based and place your data on a web server. Access/Jet isn't really designed for those workloads, but running a small site with minimal transactions and users can be done. Otherwsie, consider switching to a more robust data platform like MySQL, SQL Server, etc. -- Scott McDaniel CS Computer Software Visual Bas...

Accessing 2 tables having same name but different databases ms-access
Hi, I have an application with MS-Access as backend and JSP/ tomcat as frontend/webserver. For getting better response time(as access is very slow compared to other RDBMS's), I have split the main DB into two DB's on different disks on my server for better performance.I have kept the table names same but changed the DB names. How do I access tables from both the DB's? This is what I have done; I made different connection to the respective DB's i.e. con and con2. When I want to access data, I am using 2 result sets for retriving data from the tables, but getting no re...

HXTT Access v1.0 Released for MS Access database
HXTT Access provides a type 4 JDBC driver for Table, System Table, View(Query), and Linked Table of Microsoft Access (MS Access) version from 2.0, 95, 97, 2000, XP, 2002, to 2003. It supports JDBC1.2, JDBC2.0, and JDBC3.0. It supports Personal Java, JDK1.0.X, JDK1.1.X, JDK1.2.X, JDK1.3.X, JDK1.4.X and JDK1.5.X. It supports JBuilder's Database Pilot, Oracle's JVM, JDeveloper 10G, Dreamweaver UltraDev, Dreamweaver ColdFusion, ObJectRelationalBridge, DBVisualizer, Sunopsis, MySQL Migration Toolkit, Tomcat, vqServer, Hibernate, SQuirreL SQL Client, and DbEdit Database Utilites for Eclipse Platform. It supports transaction, XOPEN SQLState, RMI, Jini, JNDI, and serialization. It supports { UNION | INTERSECT | EXCEPT | MINUS } [ ALL ] query , INNER JOIN, FULL JOIN, LEFT JOIN, RIGHT JOIN, NATURAL JOIN, CROSS JOIN, self join, and subquery which includes single-row subquery, multirow subquery, multiple-column subquery, inline views, and correlated subquery. The current version of the HXTT Access packages are available at http://www.hxtt.net/en/software/download.jsp?product=Access . ...

HELP ACCESS DATABASE VB6 WITH WINE UNDER KUBUNTU ONNETWORK ACCESs
Greetings, and thankful for your replies. I have an application on vb6 +msaccess network accesing works with no problem on windows, but now i have a client machine with Kubuntu and wine, when running the program it gives an error that it cannot connect to the database, which is on another computer a network W2003Server, which means that the route code to \\server\files\db.mdb its not FOUND!! obviosly this under windows does work, but in linux with WINE cannot access to that route. I used mount cifs to make a mount point on my kubuntu PC for the database on the server over the ...

access to Access
We use MS access 2000 at work and few people know how to work it including me. We are using it on a network and more than one person is trying to access it at once. Needless to say this isn't working as one has to log out first before another can enter data. Is there an easy way around this? Or a complicated way, actually I'll take anyway. Thanks Mike We have just started this database so any changes would be better done sooner. Mike Kelliher wrote: > We use MS access 2000 at work and few people know how to work it > including me. > We are using it on a network and mo...

Help connect Ms access database
Hello All, I am trying to connect an MS database without utilizing the help of the "querybuilder", I know how to do that using the "querybuilder" but this can't work as I am trying to do an exe file and be able to use it for other pc's that I have. I am doing the following, please correct me if I am wrong, but it is not working at all: dbpath=[matlabroot,'a\toolbox\database\dbdemos\trial.accdb']; conurl = ['jdbc:odbc:Driver={Microsoft Access Driver (*.mdb,*.accdb)};' ... 'DBQ=' dbpath] conn=database('Trial_now','','&#...

access to Access
I've been reading some old posts that talk of an inability to connect to an Access database with RB. Is that (still) true? If so, that would be a show stipper for us. Thanks for any insight, dave In article <1187719558.603002.257260@q3g2000prf.googlegroups.com>, Dave <davegp2@msn.com> wrote: > I've been reading some old posts that talk of an inability to connect > to an Access database with RB. Is that (still) true? If so, that > would be a show stipper for us. I've never tried it, but I think you should be able to access Access via ...

multiple users' simultaneous access to a MS Access database
When my end user clicks on the icon for her MS Access database (the icon is on her Novell NAL menu) she is successful in opening the database. However, when another staff member is using the database she receives the message that someone is using it and she cannot access it at that time. Any suggestions as to what I need to do to resolve this? I guess it would be a fix to allow multiple users simultaneous access to a MS Access database? Thanks in advance, Zuf Per zufie: >When my end user clicks on the icon for her MS Access database (the >icon is on her Novell NAL menu...

accessing MS Access database fila via ODBC problem
Hi! I'm trying to connect to a MDB file via ODBC like this: char *DSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\dev-cpp\\test\\1.mdb"; SQLAllocEnv(&env); SQLAllocConnect(env, &hdbc); SQLBrowseConnect(hdbc, (UCHAR*)DSN, strlen(DSN), (UCHAR*)buf, BUF_SIZE, (SQLSMALLINT*)&rcvlen); The function SQLBrowseConnect fails and SQLGetDiagRec returns "IM001 Driver does not support this function" Can anyone help me? Thanks! David On S...

Web resources about - request for explanation on access an database in ms access - comp.lang.java.help

Explanation - Wikipedia, the free encyclopedia
An explanation is a set of statements constructed to describe a set of facts which clarifies the causes , context , and consequences of those ...

An Explanation of Captchas - Facebook
Facebook Security hat eine Notiz mit dem Titel An Explanation of Captchas geschrieben. Du kannst den vollständigen Text hier lesen.

Facebook modifies proposed changes to terms of service, provides explanations in response to user feedback ...
Facebook today released a new set of proposed changes to its terms of service and offered more detailed explanation of its revisions based on ...

What is a good explanation of Latent Dirichlet Allocation?
Answer (1 of 2): Suppose you have the following set of sentences: * I ate a banana and spinach smoothie for breakfast * I like to eat broccoli ...

SAP HANA Certification and Interview Test Prep - Questions, Answers and Explanation on the App Store ...
Get SAP HANA Certification and Interview Test Prep - Questions, Answers and Explanation on the App Store. See screenshots and ratings, and read ...

The Higgs and a Jewish Wedding: An Explanation of the Higgs Field - YouTube
I use the behavior of people at a festive Jewish wedding to explain the action of the Higgs Fieldthe field that carries the action of the Higgs ...

Gold Coast police not buying bikie 'holiday' explanation
When five Victorian bikies were arrested at Surfer's Paradise on Sunday morning, they told police there was just one reason they had ventured ...

Stephen Roach Has A Rational Explanation For All Of China's Ghost Cities
China has received much flak for building “ghost cities” and “bridges to nowhere.” Recent reports show that construction in Ordos, the most famous ...

Cowboys demand NRL obstruction explanation
Coach Paul Green says the NRL owes North Queensland an explanation after a controversial obstruction ruling against them in the 26-21 loss to ...

AFL grand final 2015: Billy Brownless calls mum a stripper, Sam Newman explanation - HeraldSun Search ...
SAM Newman has called on everyone to cut Billy Brownless some slack over sexist comments he made towards a mother and daughter.

Resources last updated: 2/28/2016 12:33:04 PM