Home  >  Article  >  Database  >  java-MyEclipse执行成功,但mysql没有数据。

java-MyEclipse执行成功,但mysql没有数据。

WBOY
WBOYOriginal
2016-06-06 09:43:521632browse

mysqljava数据库没数据数据库连接

<code>    Class.forName("com.mysql.jdbc.Driver");        ct=DriverManager.getConnection("jdbc:mysql://localhost:3306/test1","root","wenhao");        sm=ct.createStatement();        rs=sm.executeQuery("select *from test");        try {        ps=ct.prepareStatement("insert test values(14,'aaa')");        System.out.print("插入成功");        } catch (Exception e) {            // TODO Auto-generated catch block            System.out.print("插入失败");        }</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn