Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > JDBC/ODBC Connection Failed error in Tomcat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-28-03, 04:02
Daria Daria is offline
Registered User
 
Join Date: Oct 2003
Location: NJ
Posts: 1
Post JDBC/ODBC Connection Failed error in Tomcat

I am trying to connect to an Access Database using Java. I am a freelance programmer and Can not insert etc right now into this Database. It is due in a month and can not continue programming cause of connectin error: Microsoft ODBC Driver Manager Data Sourc name not found...Driver specified Java SQL Exception""""""


Code below: System out print lines tell me it fails after the url...please help!!!

import java.sql.*;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class MakeConnection extends HttpServlet
{

MakeConnection()
{
loadAccessJDBCDriver();
}
public static void loadAccessJDBCDriver()
{
try{
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
System.out.println ("Loading Database driver...");
}
catch(SQLException e)
{
System.err.println(e.getMessage() + "\n" + e.toString());
}
}
public static Connection getConnected()
{
try{
System.out.println("Before Connected");
String jdbc_url = "jdbcdbc:Polite";
System.out.println("Connected 3");
Connection conn = DriverManager.getConnection(jdbc_url);
//Connection conn = DriverManager.getConnection(jdbc_url, "Scott", "Tiger");
System.out.println("Connected");

return conn;

}
catch(SQLException e)
{
System.err.println(e.getMessage() + "\n" + e.toString());

}
return null;
}
public static Statement makeStatement(Connection conn)
{
try{
Statement stmt = conn.createStatement();
return stmt;
}
catch(SQLException e)
{
System.err.println(e.getMessage() + "\n" + e.toString());
}
return null;
}
public static void closeThingsDown(Statement stmt, Connection conn)
{
try{
stmt.close();
conn.close();
}
catch(SQLException e)
{
System.err.println(e.getMessage() + "\n" + e.toString());
}

}
public static ResultSet openResultSet(Statement stmt, String query)
{
try{

ResultSet rs = stmt.executeQuery(query);

return rs;
}
catch(SQLException e)
{
System.err.println(e.getMessage() + "\n" + e.toString());
}
return null;

}
}

Last edited by Daria : 11-03-03 at 09:31.
Reply With Quote
  #2 (permalink)  
Old 11-19-03, 22:50
rohit_kumar_gup rohit_kumar_gup is offline
Registered User
 
Join Date: Nov 2003
Location: Bangalore
Posts: 1
did you get any answers

Hi,

I am facing the same problem. Did you get any answers for your question ? If you ahve got an answer, let me know.

Thanks in advance.

Rohit.
Reply With Quote
  #3 (permalink)  
Old 11-20-03, 05:26
adam_ac adam_ac is offline
Registered User
 
Join Date: Nov 2003
Location: Jakarta, Indonesia
Posts: 32
change the e.getMessage() to e.printStackTrace()
and post the stack trace
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On