Problemas con JDBC
Estoy desarrollando una fabrica de conectores hacia varios manejadores de bases de datos en JBuilder, pero en el momento de crear el conector en SQL Server y en My SQL se crea una excepcion y el conector no funciona. Ya segui todos los pasos de la documentacion de ambos drivers tanto para instalacion de los mismos como de la inicializacion de CLASSPATH sin exito. Qque mas debo considerar para abrir conexiones con JDBC en Windows?
Ahora al momento de ejecutarlo me sale el siguiente error que puedo hacer
java.lang.NoSuchMethodError: main
Exception in thread "main"
import java.io.*;
import java.sql.*;
import java.util.*;
public class insert2 {
public static void main(String DRIVER){
// public static void main(String DRIVER){
System.out.println("prueba de JDBC");
Connection con = null;
// "org.gjt.mm.mysql.Driver"
String driver = DRIVER;
//// String driver = "org.gjt.mm.mysql.Driver";
String url = "jdbc:mysql://192.168.0.200/PRUEBA";
String name = "";
String password = "";
try {
Class.forName(driver);
} catch(Exception e) {
System.out.println("Error respecto al driver " + driver);
System.out.println(e.getMessage());
System.exit(0);
}
try {
con = DriverManager.getConnection(url, name, password);
} catch(Exception e) {
System.out.println("Error de acceso al url " + url + " para usuario" + name);
System.out.println(e.getMessage());
System.exit(0);
}
//String sql = "INSERT INTO TABLA VALUES (Ross, Qro, 2-xxx, is1)";
String sql = "INSERT INTO TABLA " +
"VALUES ('yarethe2','qro','222','is1')";
/* String NOMBRE= "Ross",
CITY= "QRO",
TEL= "2-XX",
EMPRESA= "IS1";
String sql = "INSERT INTO TABLA ";
sql += " VALUES(" + quote(NOMBRE) + ", ";
sql += quote(CITY) + ", ";
sql += quote(TEL) + ", ";
sql += quote(EMPRESA) + ");";*/
// stmt.executeQuery(sql);
try {
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
/* con.setAutoCommit(false);
stmt.addBatch("INSERT INTO TABLA" +
"VALUES('rOSS', 'QRO', '2-XXX', 'IS1')");
stmt.addBatch("INSERT INTO TABLA" +
"VALUES('OTRO', 'OTRA', 'OTRO', 'OTRA')");
int [] updateCounts = stmt.executeBatch(); */
stmt.executeUpdate(sql);
} catch(Exception e) {
// System.out.println("Error ejecutando " + sql);
System.out.println(e.getMessage());
System.exit(0);
}
}
}
java.lang.NoSuchMethodError: main
Exception in thread "main"
import java.io.*;
import java.sql.*;
import java.util.*;
public class insert2 {
public static void main(String DRIVER){
// public static void main(String DRIVER){
System.out.println("prueba de JDBC");
Connection con = null;
// "org.gjt.mm.mysql.Driver"
String driver = DRIVER;
//// String driver = "org.gjt.mm.mysql.Driver";
String url = "jdbc:mysql://192.168.0.200/PRUEBA";
String name = "";
String password = "";
try {
Class.forName(driver);
} catch(Exception e) {
System.out.println("Error respecto al driver " + driver);
System.out.println(e.getMessage());
System.exit(0);
}
try {
con = DriverManager.getConnection(url, name, password);
} catch(Exception e) {
System.out.println("Error de acceso al url " + url + " para usuario" + name);
System.out.println(e.getMessage());
System.exit(0);
}
//String sql = "INSERT INTO TABLA VALUES (Ross, Qro, 2-xxx, is1)";
String sql = "INSERT INTO TABLA " +
"VALUES ('yarethe2','qro','222','is1')";
/* String NOMBRE= "Ross",
CITY= "QRO",
TEL= "2-XX",
EMPRESA= "IS1";
String sql = "INSERT INTO TABLA ";
sql += " VALUES(" + quote(NOMBRE) + ", ";
sql += quote(CITY) + ", ";
sql += quote(TEL) + ", ";
sql += quote(EMPRESA) + ");";*/
// stmt.executeQuery(sql);
try {
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
/* con.setAutoCommit(false);
stmt.addBatch("INSERT INTO TABLA" +
"VALUES('rOSS', 'QRO', '2-XXX', 'IS1')");
stmt.addBatch("INSERT INTO TABLA" +
"VALUES('OTRO', 'OTRA', 'OTRO', 'OTRA')");
int [] updateCounts = stmt.executeBatch(); */
stmt.executeUpdate(sql);
} catch(Exception e) {
// System.out.println("Error ejecutando " + sql);
System.out.println(e.getMessage());
System.exit(0);
}
}
}