File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes jdbc programm connecting DB2, error thrown in cmd as Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc programm connecting DB2, error thrown in cmd as "null user id is not supported"" Watch "jdbc programm connecting DB2, error thrown in cmd as "null user id is not supported"" New topic
Author

jdbc programm connecting DB2, error thrown in cmd as "null user id is not supported"

riyaz udeen
Ranch Hand

Joined: Sep 11, 2005
Posts: 66
hye every one. i wrote a jdbc program and saved it as .java file from notepad in order to connect Db2. the code is as follows:

import java.sql.*;

public class jdbc {

public static void main( String arg[]) {

Connection c = null;
Statement st = null;
ResultSet rs;
String query = "CREATE TABLE book ( NAME VARCHAR(20),ID INTEGER,RATE INTEGER)";
String query1 = "INSERT INTO book VALUES ( 'HFSJ',1,100)";
String query2= "INSERT INTO book VALUES ( 'JSPCOOKBOOK',2,90)";


try {
Class.forName("com.ibm.db2.jcc.DB2Driver");
}

catch( Exception ex) {
System.out.println(ex.getMessage());
}

try {

c = DriverManager.getConnection("jdbc b2://localhost:50000/sample?UserID=pentium4&password=18may2003");
st = c.createStatement();
st.executeUpdate(query);
st.executeUpdate(query1);
st.executeUpdate(query2);
st.executeUpdate("INSERT INTO BOOK VALUES ( 'SCJP',1,200)");
rs= st.executeQuery("SELECT * FROM BOOK");

while(rs.next())
{
System.out.println(rs.getString("NAME")+" " +rs.getInt("ID")+" "+rs.getInt("MARKS"));
}


}

catch(SQLException e)
{
System.out.println(e.getMessage());
}

}
}


i got the error as "[ibm][db2][jcc][t4][10205][11234] Null userid is not supported."

but i have placed the jar files (C:\Program Files\IBM\SQLLIB\java\db2jcc_license_cu.jar;C:\Program Files\IBM\SQLLIB\java\db2jcc.jar) in classpath environmental system variables.

can you kinldy provide me sollution. thanks in advance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jdbc programm connecting DB2, error thrown in cmd as "null user id is not supported"