Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JDBC Problem

Status
Not open for further replies.

porto2001

Programmer
Mar 7, 2001
24
PT
SQL Exception No suitable driver.

This is my code:

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(Exception e){
setError("Can´t find database driver class: "+e);
return;
}

try{
String url="jdbc:eek:dbc:HumanResources";
java.sql.Connection c = DriverManager.getConnection(url,"admin","hr");

java.sql.Statement st = c.createStatement();
java.sql.ResultSet rs = st.executeQuery("select * from HRMHR");
java.sql.ResultSetMetaData md = rs.getMetaData();

rs.close();
c.close();

}catch(SQLException ee){
setError("SQLException "+ee.getSQLState());
}

The message of getSQLState is 08001

I´m using Windows2000, IIS, and a MSAccess database.

With applet viewer works fine, but with a browser, SQLException appears.

I don´t know if it´s the security policy, or some problems with system dns or file dns.
If the problem is file dns, please help, cause i really don´t understaind much of it.

i have the sun/jdbc/odbc/*.class in my InetPub/ i have try to put the database file in InetPub/
i am trying to run the applet in the same computer where IIS is installed.

i added rt.jar to my system classpath.

i really need help....
 
The problem is you are trying to access the applet from the same computer that is serving it. IE sees this as a security volation because it considers the machine as the client and it will not allow client-access to the applet. If you tested the applet from another machine than I am sure it would work. Wushutwist
 
that is the best suggestion. the java security policy doesn't allow applets access the local machine by default. this can be changed but its not recommended.

if u really want to get into java programming you should consider developing some servlets with a servlet engine and have them. or even better, a tiered application under them, to access the database.

--------------------

"I'm not normally a religious man, but if you're up there, save me, Superman!" Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top