Rakafkaven
asked on
newbie: JDBC query exception: "SQL0204 *tablename* in *username* type FILE not found"
This error doesn't make sense to me, and makes me think that I'm doing something silly when connecting to my database. Everything compiles just fine, and the connection seems to go fine (as far as I can tell) until my retrieveData procedure throws an exception that says "BLLOPER in MYUSERNAME type *FILE not found". BLLOPER is the table name targeted by my SELECT query, and MYUSERNAME is the username I use in the Connection string to log in. I wouldn't expect to find a table in a username. I'm not sure why Java does. Probably something to do with my Connection string, but if I really knew what I was doing, I wouldn't be begging for help here.
Code is cribbed heavily from:http://www.javacamp.org/moreclasses/jdbc/jdbc.html
Connection string partially derived from: http://publib.boulder.ibm.com/infocenter/hod9help/index.jsp?topic=/com.ibm.hod9.doc/help/db_url.html
import java.sql.*;
public class TestDBDriver {
static Connection con;
static Statement stmt;
static ResultSet rs;
static DatabaseMetaData dmd;
public static void main(String[] args) {
loadDriver();
makeConnection();
retrieveData();
} //main
static void loadDriver() {
try {
Class.forName("com.ibm.as4 00.access. AS400JDBCD river");
} catch(java.lang.ClassNotFo undExcepti on e) {
System.err.print("ClassNot FoundExcep tion: ");
System.err.println(e.getMe ssage());
} //try
} //loadDriver
static void makeConnection() {
String url = "jdbc:as400://10.2.2.11;da tabase name=MYDBNAME";
String user = "MYUSERNAME";
String pwd = "MYPWD";
try {
con = DriverManager.getConnectio n(url, user, pwd);
} catch(SQLException ex) {
System.err.println("databa se connection: " + ex.getMessage());
} //try
} //makeConnection
static void retrieveData() {
try {
String opSQL = "SELECT ODESC FROM BLLOPER";
stmt = con.createStatement();
rs = stmt.executeQuery(opSQL);
while (rs.next()) {
String s = rs.getString("ODESC");
System.out.println(s);
} //while
} catch(SQLException exrd) {
System.err.println("retrie ve failed: " + exrd.getMessage());
} //try
} //retrieveData
} //class
Code is cribbed heavily from:http://www.javacamp.org/moreclasses/jdbc/jdbc.html
Connection string partially derived from: http://publib.boulder.ibm.com/infocenter/hod9help/index.jsp?topic=/com.ibm.hod9.doc/help/db_url.html
import java.sql.*;
public class TestDBDriver {
static Connection con;
static Statement stmt;
static ResultSet rs;
static DatabaseMetaData dmd;
public static void main(String[] args) {
loadDriver();
makeConnection();
retrieveData();
} //main
static void loadDriver() {
try {
Class.forName("com.ibm.as4
} catch(java.lang.ClassNotFo
System.err.print("ClassNot
System.err.println(e.getMe
} //try
} //loadDriver
static void makeConnection() {
String url = "jdbc:as400://10.2.2.11;da
String user = "MYUSERNAME";
String pwd = "MYPWD";
try {
con = DriverManager.getConnectio
} catch(SQLException ex) {
System.err.println("databa
} //try
} //makeConnection
static void retrieveData() {
try {
String opSQL = "SELECT ODESC FROM BLLOPER";
stmt = con.createStatement();
rs = stmt.executeQuery(opSQL);
while (rs.next()) {
String s = rs.getString("ODESC");
System.out.println(s);
} //while
} catch(SQLException exrd) {
System.err.println("retrie
} //try
} //retrieveData
} //class
ASKER
Fixed. Thats the error you get when you spell your table name incorrectly. Painfully obvious, but the weird mention of the username in the error was throwing me. Anyone who can explain why that happened still gets the points.
> Thats the error you get when you spell your table name incorrectly
each table will be stored as a file also on some DB there is a separate file for table schema.
this is whay you get *tablename* in *username* type FILE not found
each table will be stored as a file also on some DB there is a separate file for table schema.
this is whay you get *tablename* in *username* type FILE not found
also it could be spelled that the there is no table with the specified name in this username account
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks everyone!
ASKER
Still, a new and exciting variation on the same error is not a solution. Any input would be greatly appreciated.