//JDBC-ODBC 不用 odbc DSN 方法
import java.lang.*;
import java.sql.*;
import javax.sql.*;
public class testjo
{
public static void main(String[] args)
{
String odbcurl="jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=stick.mdb"; //注意Driver和扩号(之间有空格
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
java.sql.Connection c = DriverManager.getConnection(odbcurl);
java.sql.Statement st = c.createStatement();
java.sql.ResultSet rs = st.executeQuery("select * from stickstory");
java.sql.ResultSetMetaData md = rs.getMetaData();
while(rs.next())
{
System.out.print("\nTUPLE: | ");
for(int i=1; i<= md.getColumnCount(); i++)
{
System.out.print(rs.getString(i) + " | ");
}
}
rs.close();
}catch (Exception e)
{
e.printStackTrace();
}
}
}