This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I'm trying to keep my SQL free of qualifying schema names, e.g. MYUSER.MYTABLE. I want this because the schemas represent the different environments, like TEST, DEMO and so on. My question is: If I have a DB2 user called TESTUSER, this will be his default schema name as well. How do I change this to the appropriate schema, e.g. TEST? Is it done on the connection? I use a DataSource approach and CMP generated code, so I don't have access to the connection as such. Cheers, Mikkel
I put the schema name in a properties file - which could different for each environment. Then for any sql statement in my code, I add the schema before the table name as in: sql = "select a, b, c from " + props.getProperty("dbSchema") + ".TableXYZ where a = ?";
I set the library in my Connection URL( don't have my AS/400 stuff at home, but it comes after the DBName ). It suggests which library to search for the table/file first. But if it doesn't find it in the specified library, it will search the rest of the library list entries( may or may not be desirable ). It's somewhere in the AS/400 toolbox documentation for establishing a Connection. Jamie