Mysql JDBC problem
Hi All
I hope someone can help me as I am having problems connecting to a MySQL database through a JSP web application using netbeans and sun applications server.
Here is my process;
Connect the Mysql database in netbeans
|
Create a connection pool
|
Create a JDBC resource
|
try and obtain a reference to the JDBC resource using the following code:
private javax.sql.DataSource getKarlLaptopJDBCResource() throws javax.naming.NamingException {
javax.naming.Context c = new javax.naming.InitialContext();
return (javax.sql.DataSource) c.lookup("java:comp/env/jdbc/KarlLaptopJDBCResource");
}
when I call source = getKarlLaptopJDBCResource();
source comes back as null;
I am able to ping the db from within the admin console. There is no entry under JNDI which relate to my database and i am not sure if i require one.
Easy time i just get a null response when trying to look up a connection.
If anyone knows of any comprehensive documentation or tutorials as I would be most grateful
Regards
Karl

