this question may fit better into the Database category instead of Java. Anyway, I hope somebody can help me here.

I have successfully connected to MS SQl server via JDBC-ODBC bridge driver.  My problem is I dont know how to access the table, I created a table names emp under "tempdb"(or something like that), but when I tried to the statement "select * from emp", I was told "invalid object name emp".   I never used MS SQL before, I have no idea about it.  is there command line inferface like SQL * plus for Oracle in MS SQL?  what is wrong with the emp table I created?

Thanks & merry x-mas
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

With SQL Server Entreprise Manage, You can browse the database, table , etc.
 And don't create table under tempdb , which is a reserved database used by SQl.

**************from MSDN*************
tempdb holds all temporary tables and temporary stored procedures. It also fills any other temporary storage needs such as work tables generated by SQL Server. tempdb is a global resource; the temporary tables and stored procedures for all users connected to the system are stored there. tempdb is re-created every time SQL Server is started so the system starts with a clean copy of the database. Because temporary tables and stored procedures are dropped automatically on disconnect, and no connections are active when the system is shut down, there is never anything in tempdb to be saved from one session of SQL Server to another.

tempdb autogrows as needed. Each time the system is started, tempdb is reset to its default size. You can avoid the overhead of having tempdb autogrow by using ALTER DATABASE to increase the size of tempdb.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EmbtAuthor Commented:
here is my code:
import java.sql.*;

public class Jdbc_odbc {

public static void main(String args[]) throws SQLException {

try {
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");

Connection conn = DriverManager.getConnection("jdbc:odbc:test", "", "");


Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from emp");
while(rs.next()) {
   int  empno = rs.getInt(1);
   String  ename = rs.getString(2);
  System.out.println(empno + "\t" + ename);



in MS SQL server, under which catogory can I create the table so I can access it from the query in my java code?
By default the ODBC for SQL Server searches only in the master db. While configuring the DSN for SQL Server, you have to specify the database as tempdb.
   create your new database and create table inside it. And make sure your dsn is correctly configured.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.