?
Solved

newbie: JDBC query exception: "SQL0204 *tablename* in *username* type FILE not found"

Posted on 2006-05-05
6
Medium Priority
?
4,650 Views
Last Modified: 2007-12-19
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.as400.access.AS400JDBCDriver");
} catch(java.lang.ClassNotFoundException e) {
      System.err.print("ClassNotFoundException: ");
      System.err.println(e.getMessage());
} //try
} //loadDriver

static void makeConnection() {
String url = "jdbc:as400://10.2.2.11;database name=MYDBNAME";
String user = "MYUSERNAME";
String pwd = "MYPWD";
try {
      con = DriverManager.getConnection(url, user, pwd);
} catch(SQLException ex) {
      System.err.println("database 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("retrieve failed: " + exrd.getMessage());
} //try
} //retrieveData
} //class
0
Comment
Question by:Rakafkaven
  • 3
  • 2
6 Comments
 
LVL 4

Author Comment

by:Rakafkaven
ID: 16617966
Changing opSQL to read "SELECT ODESC FROM MYDBNAME.BLLOPER" changes my error message to "[SQL0204] BLLOPER IN MYDBNAME type *FILE not found", which at least makes English-language sense to me:  can't find table in database.  Not sure why that changes anything, or why the database name in my Connection url didn't do this anyway... but whatever.

Still, a new and exciting variation on the same error is not a solution.  Any input would be greatly appreciated.
0
 
LVL 4

Author Comment

by:Rakafkaven
ID: 16618009
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.
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 16618072
> 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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:hoomanv
ID: 16618083
also it could be spelled that the there is no table with the specified name in this username account

0
 
LVL 23

Accepted Solution

by:
Siva Prasanna Kumar earned 2000 total points
ID: 16619412
>>MYDBNAME.BLLOPER

Your Database is using DatabaseName.TableName format to index i.e to look out for your table this varies from database to database.

>>String url = "jdbc:as400://10.2.2.11;database name=MYDBNAME";

here your database name is not a part of your url as it it self is a another satement. i.e the above statement is equal to

String url = "jdbc:as400://10.2.2.11;
database name=MYDBNAME";

if you  just wanted to mention your table and wanted to make yourdatabase name a part of the url then check out

http://www.javacamp.org/moreclasses/jdbc/jdbc.html

Thank You.


0
 
LVL 4

Author Comment

by:Rakafkaven
ID: 16653833
Thanks everyone!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question