07-31-07 06:21 PM
I'm new to Java and even newer to WebSphere so please pardon my newbiness. I
s it <i>wrong</i> to call a datasource you've created in WAS directly from a
portlet?
Also, in this following snippet of code what does "comp" and "env" represent
in the string?
<code>
Context initialContext = new InitialContext();
javax.sql.DataSource myDS =
(javax.sql.DataSource) initialContext.lookup(
"java:comp/env/jdbc/DB2DataSource");
// create a connection from the Data Source
Connection connection = myDS.getConnection();
// create a query from the connection
java.sql.Statement query =
connection.createStatement();
<code>
Thanks for reading.
[ Post a follow-up to this message ]
|