Wednesday, 13 April 2011

C:\Users\ABC\Desktop\prjct1\project\bgss-war\src\java\control\mysqlbean.java:26: illegal escape character
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ABC","ABC-PC\ABC","");
1 error
C:\Users\ABC\Desktop\prjct1\project\bgss-war\nbproject\build-impl.xml:407: The following error occurred while executing this line:
C:\Users\ABC\Desktop\prjct1\project\bgss-war\nbproject\build-impl.xml:224: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)








code ye hai ,,,,,




/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package control;
import java.sql.*;

/**
 *
 * @author sony
 */
public class mysqlbean {
private  Connection con;
  private      Statement stmt;
  private      ResultSet rs;
 
public mysqlbean()
{
    super();
}
public boolean connect() throws ClassNotFoundException,SQLException{
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ABC","ABC-PC\ABC","");
         return true;
}catch(Exception e){ return false;}
}

public void close() throws SQLException
{
    con.close();
}
public ResultSet execSQL(String sql) {
try{
    stmt=con.createStatement();

ResultSet r = stmt.executeQuery(sql);
return (r == null) ? null : r;
}
catch(Exception e)
{
   System.out.println(e);
   return null;
}
}
  public int updateSQL(String sql) throws SQLException{
             stmt = con.createStatement();
int r = stmt.executeUpdate(sql);
return (r == 0) ? 0 : r;
}

    }

No comments:

Post a Comment