By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,468 Members | 1,859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,468 IT Pros & Developers. It's quick & easy.

I know a little~~~~~~~~~:)

P: n/a
first,install java and jdbc on your machine;
you'd better install SQL 2000 on your;and my OP is Windows 2000
advanced server,which surport SQL 2000 Server;For this,I give up
Winxp
and Win98;
then,Install a driver on your machine.
and I use jdbc-odbc
now you can program java application;Java applet is a little
difficult,because
it's usual forbidden to do this,but you can change this.
now I list my code:
import java.sql.*;

public class Test002 extends {
public Connection con;
public Statement st;
public ResultSet result;
public void init()throws Exception{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");//加载驱动程序

this.con=DriverManager.getConnection("jdbc:odbc:JD BC-ODBC");//取得数据源并进行连接

this.st=this.con.createStatement();

}
public void paint()throws Exception{
this.result=this.st.executeQuery("SELECT * FROM authors");
while(this.result.next()){

System.out.print(this.result.getString(1)+" "+'\t');

System.out.print(this.result.getString(2)+" "+'\t');

System.out.print(this.result.getString(3)+" "+'\t');

System.out.println();}

}

public static void main(String[] args) throws Exception{
Test002 test = new Test002();

test.init();
test.paint();
test.con.close();
}

}
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.