|
Hi!
Here's a code snippet to get you
started:
Class.forName("sun.odbc.jdbc.OdbcJdbcDriver").newInstance(); // register your
driver
Connection con =
DriverManager.getConnection("jdbc:odbc:mydb"); // mydb must be specified in the
control panel under datasources
Statement st =
con.createStatement();
// to get data
ResultSet rs =
st.executeQuery("SELECT * FROM aTable");
while
(rs.next()){...}
// to insert data
st,executeUpdate("Insert into
aTable values("..."));
// ... see javadocs for more
things you can do.
Now you should read the java turorial (database
access with jdbc; see java.sun.com), and a tutorial to get used to the SQL
syntax.
-mw
|
- Shopping Cart Example Wasala Mudiyanselage Nilantha Piyasiri
- Michael Weller
