• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database connection problem

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic