Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDBC ODBC System vs User DSN

843854Jun 6 2002 — edited Jun 6 2002
Hi... I've got an Acees db setup as a User DSN source. When I acees this source off of this machine with a java executable ( one with a main method), no problems. When I put the exact same connection code into a JSP page, I get the following error...

SQLException : [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Is this error because I'm accessing the JSP through a server which resides on another machine and so doesn't see the User DSN source? If so, how do I create a System DSN? I'm on a university intranet here and they don't allow us to do anything (or maybe I'm just bad :D) On the university's intranet page it does say the following...

"DATABASE support (System DSN called 0014157, access 2000 database in database folder)"

But eh, like, er, how do I write the connection line then? Do I just stick my database into the database folder and er, like, then, er, what... ?

All and any help appreciated... merry christmas.
import java.sql.*;

public class Test {
	public static void main (final String [] args) {
		try {
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			Connection con = DriverManager.getConnection ("jdbc:odbc:217cw");
			Statement stmt = con.createStatement();
			ResultSet res = stmt.executeQuery ("SELECT ImageUrl FROM Weapons");
			while (res.next ()) {
				System.out.println (res.getString ("ImageUrl"));
			}
		}
		catch (final SQLException sqe) {
			System.out.println (sqe.getMessage ());
		}
		catch (final ClassNotFoundException cnfe) {
			System.out.println (cnfe.getMessage ());
		}
	}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2002
Added on Jun 6 2002
1 comment
256 views