aspose file tools*
The moose likes JDBC and the fly likes jdbc advanced Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc advanced" Watch "jdbc advanced" New topic
Author

jdbc advanced

joseph jacob
Greenhorn

Joined: Jan 14, 2001
Posts: 6
can i connect directly to msaccess database .if yes how
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

there are a whole bunch of replies like this, but here is one http://www.javaranch.com/ubb/Forum3/HTML/001275.html
Dave
Dorj Galaa
Ranch Hand

Joined: May 29, 2001
Posts: 113
u must create ODBC DSN
java sample
import java.sql.*;
String url="jdbc dbc:yourodbcdsn";
int Recordcount=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection access=DriverManager.getConnection(url,"Admin","");
Statement st=access.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
String Query="select * from table1";
ResultSet Result=st.executeQuery(Query);
Result.last();
RecordCount=Result.getRow();
Ssytem.out.println(RecordCount);
Result.close();
st.close();
access.close();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}


Senior software engineer
 
 
subject: jdbc advanced