Error on Connection

Hello all

I have this nice chunk of code that is trying to connect to a database named Prueba. it compiles just fine, but it wont work properly.. here's the code.

package prueba;

import java.sql.*;

/**

*

* @author Administrator

*/

publicclass TestCon{

publicstaticvoid main(String args[]){

Connection conexion;

Statement sentencia;

ResultSet resultado;

try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

}

catch (Exception e){

System.out.println("No se pudo conectar con el JDBC-ODBC");

return;

}

try{

conexion = DriverManager.getConnection("jdbc:odbc:con_sql","","" );

sentencia = conexion.createStatement();

resultado = sentencia.executeQuery("SLECT * FROM Empleados");

while(resultado.next() ){

String Empleado_ID = resultado.getString("IDemp");

String Nombre = resultado.getString("Nombre");

String Apellido = resultado.getString("Apellido");

System.out.println("Empleado:" + Empleado_ID +" " + Nombre +" " + Apellido);

}

}

catch( Exception e ){

System.out.println( e );

return;

}

}

}

When i run this, Netbeans says:

init:

deps-jar:

compile-single:

run-single:

java.sql.SQLException: [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near '*'.

BUILD SUCCESSFUL (total time: 1 second)

:-/

[2647 byte] By [River_Platea] at [2007-11-27 8:52:14]
# 1
I don't know what that database is, but your query is using SLECT vs. SELECT
kdajania at 2007-7-12 21:07:18 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

I cant help on solving what is wrong with your code. However, I see your using a DriverManager. That will take about 1 second for each connection obtained from the database. That is way too long to wait especially when you have hundreds of end-users using your code at the same time. If you use a connectionPool, it will take a fraction of a second to get the connection (look up connectionPool on the internet). Also, you'll need an oracle JDBC jar file that includes the connectionPool such as ojdbc14.jar (you can look that up on the internet too).

George123a at 2007-7-12 21:07:18 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
with error reporting like that. you was mistake in query. your query should be "SELECT "
460402234a at 2007-7-12 21:07:18 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...