Home > Ask the AS/400 Experts > Questions & Answers > Read from a specific member of a physical file
Ask The iSeries 400 Expert: Questions & Answers
EMAIL THIS

Read from a specific member of a physical file

Jim Mason EXPERT RESPONSE FROM: Jim Mason

Pose a Question
Other iSeries 400 Categories
Meet all iSeries 400 Experts
Become an Expert for this site
>
QUESTION POSED ON: 07 May 2003
I'm trying to read from a specific member of a physical file. I have tried using both SQL through the JDBC and the Java Toolbox for iSeries provided by IBM. I have been unable to get data into my servlet. With the JDBC all I get in the record set is CRSR0002 -- nothing at all with the toolbox. Is there some trick I'm missing?

>

Yes, there IS a trick you're missing: creating an SQL alias to point to the member BEFORE retrieving the data.

I always create the _alias name as a combination of the tableName and the memberName so it's easy to know where I'm pointing.

Here's an example:

 
aConnection = jdbcDriver.connect(tableUrl,
tableProperties);	

selectStmt = stmt;
sqlStmt = (java.sql.Statement)
getSqlStatement(aConnection);

String _sql = "CREATE ALIAS " + _alias + " FOR " +
_tableName + " (" + _memberName + ") ";
sqlStmt.execute(_sql);

resultSet = sqlStmt.executeQuery(selectStmt); 

==================================
MORE INFORMATION ON THIS TOPIC
==================================

Check out this live Q&A with Dave Slater and Jim Mason, How to best get started with WebSphere Development Tools.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



iSeries Networking - Printing, Remote Access, TCP/IP
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts