Results 1 to 6 of 6
Thread: accessing ms. access
- 08-19-2010, 04:57 PM #1
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
- 08-20-2010, 09:51 AM #2
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 697
- Rep Power
- 6
Hello,
You can use the Sun JDBC ODBC Driver (sun.jdbc.odbc.JdbcOdbcDriver) to access and manipulate the Microsoft Access database.Website: Learn Java by Examples
- 08-20-2010, 10:09 AM #3
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
Hi thanks,
could you please give me a simple example for opening Ms. Access DB?
currently, I am trying to use Jackless (Jackcess - Java Library for MS Access) .. but facing problem
TIA
- 08-20-2010, 10:30 AM #4
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 697
- Rep Power
- 6
Hello,
Here is an example that I have for opening connection to MS Access database:
The code is taken from How do I create a connection to MS Access database?Java Code:package org.kodejava.example.sql; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.PreparedStatement; public class MSAccessConnect { // // If you want to use you ODBC DSN // //private static final String URL = "jdbc:odbc:TestDB"; private static final String USERNAME = "admin"; private static final String PASSWORD = "welcome"; private static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver"; private static final String URL = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\Database\\testdb.mdb;}"; public static void main(String[] args) throws Exception { Connection connection = null; try { Class.forName(DRIVER); connection = DriverManager.getConnection(URL, USERNAME, PASSWORD); // // Do something with the connection here! // } catch (SQLException e) { e.printStackTrace(); } finally { connection.close(); } } }Website: Learn Java by Examples
- 08-20-2010, 10:39 AM #5
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
ok, I understood now.. so I should create DSN..
does the codes also compatible on Linux? ..
- 08-20-2010, 04:59 PM #6
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
Similar Threads
-
Accessing a remote Microsoft Access database
By ajeeb in forum JDBCReplies: 3Last Post: 12-01-2011, 06:40 AM -
Default Access (package access) confusion
By gauravrajbehl in forum New To JavaReplies: 1Last Post: 11-18-2009, 10:48 AM -
Accessing MS Access using DSN less connection
By Java Tip in forum Java TipReplies: 1Last Post: 03-31-2009, 05:25 PM -
Method access or field access
By carderne in forum New To JavaReplies: 2Last Post: 12-06-2008, 06:20 PM -
Help with access a database using Microsoft Access
By cachi in forum JDBCReplies: 1Last Post: 08-07-2007, 07:51 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks