Access| programming in the afternoon spent a little time, experience the next java&access programming. In fact, the company needs to integrate data from two heterogeneous systems. The database is a SQL Server with MS and the other is access. In fact, the operation of the data table is always an important step in the program. Previously, the company had been using SQL Server, and the database access operations were encapsulated with JavaBean, and most companies actually did the same.
In terms of programming, Microsoft provides a dedicated JDBC driver for SQL Server, which is the three jar files that everyone uses. But access's programming is not so luxurious, now available programming methods, just provide a JDBC-ODBC bridge to connect, the efficiency is needless to say oh.
Probably the process also a bit wordy:
1, create a URL to the database: Configure the Access data source at the same time
such as: String URL = "Jdbc:odbc:Oblog";
2, load Driver
Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver");
3, create the connection
Connection conn = drivermanager.getconnection (URL, "user", "pwd");
4, create the SQL statement object
Statement stmt = Conn.createstatement ();
5, execute the SQL statement
Stmt.execute (Strsql.tostring ());
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.