package com.jTable;
import java.util.Vector;
import javax.swing.*;
import java.util.*;
import java.sql.*;
import java.awt.*;
public class Demo1 extends JFrame
{
JTable jt = null;
JScrollPane jsp = null;
Vector row, column;
// SQL
Connection ct = null;
ResultSet rs = null;
PreparedStatement ps = null;
public static void main(String[] args)
{
// TODO Auto-generated method stub
Demo1 d = new Demo1();
}
public Demo1()
{
column = new Vector<>();
column.add("ID");
column.add("Name");
column.add("Gender");
column.add("From");
column.add("Dept");
try
{
Class.forName("com.mysql.jdbc.Driver");
ct = DriverManager.getConnection("jdbc:mysql://localhost:3306/mayan", "root", "mayan1992");
ps = ct.prepareStatement("select * from websites");
rs = ps.executeQuery();
row = new Vector<>
从数据库中取出数据
最新推荐文章于 2024-06-24 01:54:50 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)