con.createStatement() does not work

hi all

when i try to connect MSSQL 2000 server using JDBC Connection, the method createStatement() does not work. I import all the necessary java libraries also.

here is my sample program which didn't work.

import java.sql.*;

public class JDBCCon

{

public static void main (String[] args)

{

String conUrl = "jdbc:sqlserver://localhost:1433;databaseName=JavaDB;user=;password=";

Connection con = null;

Statement stmt = null;

ResultSet rs = null;

try

{

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

con = DriverManager.getConnection(conUrl);

String str = "SELECT * FROM USER";

stmt = con.createStatement();

}catch (Exception ex) {}

}}

in here con.createStatement(); is not working, it gives me a error. Please help me.

Thankz

[877 byte] By [Sana_Boya] at [2007-11-27 6:26:07]
# 1

> it gives me a error

There are countless kinds of errors and you even don't elaborate the error in detail?

Errormessages and stacktraces are not to be ignored or generalized. You, as developer, should know that better ;)

Lookup, read and interpret the error message and lookup the line where this error was been thrown. Eventually do a Google search on the exact error message. You'll be surprised how many results and answers you'll encounter.

BalusCa at 2007-7-12 17:46:36 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Thankz for ur advice..

Actually i use JCreator IDE for doing my java programs. If there is a method named createStatement(), it'll appears automatically. However i wrote a stand alone program (Without using JCreator) & the error message is "cannot find symbol"

symbol : method createSatement()

This is a compilation error;

Thnakz again

Sana_Boya at 2007-7-12 17:46:36 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
changecreateSatement()tocreateStatement()..plzz chk ur spelling always..
subbu_javaa at 2007-7-12 17:46:36 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...