I am trying a
JDBC connection for the first time. I have JDK 1.6, SQL Server 2005 and Microsoft's jdbc driver 3.0. The code goes:
and the
test class:
no compiler errors, but on running the test class, i get the following message:
F:\EVM\classes>
java com/example/DepartmentLookUp
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'dbo.departmentmaster' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2477)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1422)
at com.example.DepartmentLookUp.getDepartment(DepartmentLookUp.java:18)
at com.example.DepartmentLookUp.main(DepartmentLookUp.java:36)
The database name is VisitorLog and table name is DepartmentMaster.
Please help!
Thanks and regards,
Rasika