• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database connection problem

 
balaji vidhyadharan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using Tomcat 5.x with jdk 1.5 In tomcat admin menu i had created datasource


JNDI Name: access(local jndi name)
Data Source URL: jdbc dbc ayroll
JDBC Driver Class:
User Name: sa
Password:
Max. Active Connections: 4
Max. Idle Connections: 2
Max. Wait for Connection: 5000

after that i had created the odbc connection to my access driver thru the ODBC Data source
Administrator in the control panel of the windows xp.


After that i had modified the web.xml of the application by adding

<resource-ref>
<description>Access Connection</description>
<res-ref-name>jdbc/access</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


Now when i call the jsp it throws the error

org.apache.commons.dbcp.SQLNestedException:
Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver

What should i do now

My Jsp coding is like this

<%@ page import="javax.naming.*"%>
<%@ page import="javax.sql.*"%>
<%@ page import="java.sql.*"%>

<%
Connection conn;
try
{
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Test");
conn = ds.getConnection();
Statement stat= conn.createStatement();

What should i do to proceed further
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For MS-Access, create a DSN in your machine and access it thru DriverManager class.
I believe you can't access thru JNDI context.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic