hi all
i want to ask you how to connect java to remote ms access in another computer
thanks in advance
hi all
i want to ask you how to connect java to remote ms access in another computer
thanks in advance
Quick summary and practical options that expand on what and started: either let your Java app open the Access file over a network share (carefully), or put a small service on the machine that hosts the .accdb and have your Java code call that service. The shared-file approach is simplest to get running; the service approach is usually more robust for multi-user or internet-facing scenarios.
If you go the network-share route, use a UNC path (not a mapped drive letter when your app runs as a service) and give the service/account both share and NTFS read/write permissions. Watch the Access lock file (.laccdb/.ldb) behavior: Access creates a lock file in the same folder and high-concurrency writes can cause contention or corruption — Microsoft guidance suggests keeping heavy-write deployments to a modest number of users. Also schedule regular backups and compact/repair for reliability. (learn.microsoft.com)
Driver choices matter. The old JDBC-ODBC bridge is not a long-term solution (it was deprecated/removed from modern JDKs), so prefer a pure-Java driver such as UCanAccess (no ODBC required). Add the UCanAccess jars to your classpath (or use Maven), then open a JDBC connection with the UCanAccess URL. Example (local/shared path shown — adapt for your UNC path and classpath):
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection conn = DriverManager.getConnection("jdbc:ucanaccess://C:/shared/your.accdb;memory=false"); Using a small REST/HTTP service on the machine that holds the Access file gives the best control: the service talks to the .accdb locally (no SMB problems), enforces transactions, centralizes validation, and can implement connection pooling. For anything beyond a handful of concurrent writers, plan a migration to a server database (SQL Server, PostgreSQL, MySQL) — Access works fine for light multi-user scenarios but is not a scalable server DB. (docs.oracle.com)
Jump to Post— masijade 1,351You can't (AFAIK), not like you're thinking. MSAccess is a file, and does not have, in anyway shape or form, a network interface (AFAIK). Place the DB on a shared filesystem and access it directly, but beware of concurrent connections, those are a problem for access.
Jump to Post— masijade 1,351You do it exactly like that but with "E:" being a shared file system (a shared drive).
You can't (AFAIK), not like you're thinking. MSAccess is a file, and does not have, in anyway shape or form, a network interface (AFAIK). Place the DB on a shared filesystem and access it directly, but beware of concurrent connections, those are a problem for access.
i do not understand could you explain more i mean using something like this
String url1 = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + "E:\\fast.accdb";
Connection con=DriverManager.getConnection(url);
You do it exactly like that but with "E:" being a shared file system (a shared drive).
but the ms access database stored in another computer so how it can be reached
THAT is what the SHARED FOLDER is for. Ask your Windows System Administrators (if a business/uni system) or at a microsoft forum if personal.
thank you for replay what i understand from you that it does not need to put the ip of the another computer to access the ms access database.
you can also use a webservice, which you call. then you just use the url, and let that webservice do the communication with the db.
how can i use webservice and what you say
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.