samedi 28 mars 2015

How to connect applet with database from browser



I'm looking for a way to connect my applet with DB from browser using glassFish Server. It's working when I run it with AppletViewer but when I tried to open it in the browser, it gave me an exception: no Suitable Driver Found.


This is my method:



public Connection getConnection(){
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
} catch (Exception ex) {
}

try {
conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","stage","stage");
System.out.println("connect");
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}

return conn;
}


this is the HTML page < jsp:plugin type="applet" codebase="." code="classes/MapApplet.class" archive="applet.jar,ojdbc6.jar" width="1350" height="747" > < /jsp:plugin>




Aucun commentaire:

Enregistrer un commentaire