I
ivw
Unregistered / Unconfirmed
GUEST, unregistred user!
import java.sql.*;
import java.io.*;
public class dbtext implements Serializable
{
public static void main(String[] args) throws SQLException,ClassNotFoundException
{
dbtext dblist=new dbtext();
}
private String DBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
private String DBLocation = "jdbcdbc:free";
private String LogName = "sa";
private String Password= "";
public dbtext() throws SQLException,ClassNotFoundException
{
Connection conn = null;
ResultSet rs = null;
Statement stmt = null;
String strHint = "";
Class.forName(DBDriver);
conn=DriverManager.getConnection(DBLocation,
LogName,Password);
stmt=conn.createStatement(
);
//ResultSet.TYPE_SCROLL_SENSITIVE,
//ResultSet.CONCUR_UPDATABLE
System.out.println("连接成功!");
rs=stmt.executeQuery("select top 4 Pe01,Pe02,Pe03,Pe04 from Personnel");
//rs.beforeFirst();
int i=1;
while(rs.next())
{
System.out.println(
rs.getString(1)+" "+
rs.getString(2)+" "+
rs.getString(3)+" "+
rs.getString(4)
);
}
stmt.close();
}
}
import java.io.*;
public class dbtext implements Serializable
{
public static void main(String[] args) throws SQLException,ClassNotFoundException
{
dbtext dblist=new dbtext();
}
private String DBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
private String DBLocation = "jdbcdbc:free";
private String LogName = "sa";
private String Password= "";
public dbtext() throws SQLException,ClassNotFoundException
{
Connection conn = null;
ResultSet rs = null;
Statement stmt = null;
String strHint = "";
Class.forName(DBDriver);
conn=DriverManager.getConnection(DBLocation,
LogName,Password);
stmt=conn.createStatement(
);
//ResultSet.TYPE_SCROLL_SENSITIVE,
//ResultSet.CONCUR_UPDATABLE
System.out.println("连接成功!");
rs=stmt.executeQuery("select top 4 Pe01,Pe02,Pe03,Pe04 from Personnel");
//rs.beforeFirst();
int i=1;
while(rs.next())
{
System.out.println(
rs.getString(1)+" "+
rs.getString(2)+" "+
rs.getString(3)+" "+
rs.getString(4)
);
}
stmt.close();
}
}