Application and Database on the same server

I have a Java Application and a db2 database(SWDTEST) that reside on the same server. In the Application I want to connect to the database. What would I use to do this? When the application resides on a client machine I use the "sun.jdbc.odbc.JdbcOdbcDriver" driver and can get a connection. Code looks like:

try{

//load the driver class

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

//Define the data source for the driver

String wdURL = "jdbc:odbc:SWDTEST";

String username = "UNTEST";

String password = "PTEST";

wdConnection = DriverManager.getConnection(wdURL, username, password);

wdStatement = wdConnection.createStatement();

}

catch(SQLException e)

{

System.out.println( e.toString() );

}

But when I move the same application to the server and run it I get the following error message:

java.sql.SQLException: [IBM][CLI Driver] SQL1013N The database alias name or database name "SWDTEST" could not be found. SQLSTATE=42705

Do I need to set something on the server so that SWDTEST is a recognized database name or connect to it some other way?

Thanks in advance.

[1198 byte] By [BINDASK] at [2007-9-26 5:41:41]
# 1
Does the server have ODBC installed on it? (Windows boxes will, unix will likely not.)Do you have a ODBC driver installed on the the server. This has nothing to do with java.Have you created a DSN on the server?
jschell at 2007-7-1 13:58:12 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Thanks jschell for your reply. I did figure out the problem. All I needed to do was set the DB2INSTANCE equal to my database alias. This enabled my java program to recognize my database name.
BINDASK at 2007-7-1 13:58:12 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
I am facing with the same problem. I would appreciate if you explain this in detail with a sample code how you rectified the problem Thanks
shamyogs at 2007-7-1 13:58:12 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...