The better these AI models get, the more this is going to happen. It's gonna turn into government versus government in regards to using proprietary and unavailable security research models to basically find flaws and vulnerabilities in other governments or companies systems. It's basically turning into a cybersecurity arms race.
This is actually a good thing. The better AI gets, the more restricted and expensive it's going to become, making it far less mainstream. This is good 👍
Question
Aruz
I try to make a mysql database program in Eclipse. But I can't connect. What is the problem?
package pack; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JTextPane; public class SwingMysql extends JPanel implements ActionListener { //*************** JButton button; JTextField driver,url,user,pass,database; JTextPane status; //*************** public SwingMysql(){ url=new JTextField(20); url.setText("jdbc:mysql://localhost:3306/ss3bfd"); database=new JTextField(20); database.setText("SELECT display_name, user_email,user_nicename FROM wp_users"); user=new JTextField(5); user.setText("root"); pass=new JTextField(5); pass.setText("1234"); status=new JTextPane(); status.setText("\r ready \r"); button=new JButton("Button"); button.setActionCommand("Command1"); button.addActionListener(this); add(url); add(database); add(user); add(pass); add(button); add(status); } //*************** private static void makewin(){ JFrame.setDefaultLookAndFeelDecorated(true); JFrame myframe =new JFrame("Swing Mysql"); myframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SwingMysql floor=new SwingMysql(); floor.setOpaque(true); myframe.setContentPane(floor); myframe.pack(); myframe.setSize(300, 400); myframe.setLocation(300, 300); myframe.setVisible(true); } //*************** public void actionPerformed(ActionEvent e){ if("Command1".equals(e.getActionCommand())){ try { status.setText("\r start "); Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn=DriverManager.getConnection(url.getText(),user.getText(),pass.getText()); Statement stat=conn.createStatement(); status.setText("connected"); ResultSet re=stat.executeQuery(database.getText()); while (re.next()){ String x=re.getString("display_name"); } status.setText("congratulations"); conn.close(); } catch(Exception e1){ status.setText("Error: "+ e1.getStackTrace()); } } } //*************** public static void main(String[] args) { // TODO Auto-generated method stub makewin(); } }Thanks for your time.
Link to comment
https://www.neowin.net/forum/topic/697864-swing-mysql-connection-problem/Share on other sites
15 answers to this question
Recommended Posts