A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Databases
»
JDBC
Author
jdbc advanced
joseph jacob
Greenhorn
Joined: Jan 14, 2001
Posts: 6
posted
Jul 31, 2001 23:46:00
0
can i connect directly to msaccess database .if yes how
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
I like...
posted
Jul 31, 2001 23:53:00
0
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
posted
Aug 01, 2001 02:30:00
0
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
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: jdbc advanced
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter