Hi, The code you write in java gets converted into javascript this is what GWT does so GWT works on client side so there is some restriction on usage of classes and packages that u refer in GWT code just like *java.sql. or java.io* *these packages are not available on client side* So to use these classes,GWT has provided server side where you can access these classes so make ur connection on the server side do processing and send result back to client. Async calls would be helpful in this case.
-- Aditya On Fri, Dec 10, 2010 at 1:21 AM, Vindhya <[email protected]> wrote: > Hello Friends, > > I am new to GWT and I am developing an application, - a form based > one, to insert/delete/edit tuples in a set of tables. > > I am facing problems with the connectivity to the database. > > I kept getting an error: > java.sql.Connection can not be found in source packages. Check the > inheritance chain from your module; it may not be inheriting a > required module or a module may not be adding its source path entries > properly. > > The code I wrote is as follows: > > <code> > package com.company.rulesengine.client; > > import java.sql.*; > > import com.google.gwt.core.client.EntryPoint; > import com.google.gwt.event.dom.client.ClickEvent; > import com.google.gwt.event.dom.client.ClickHandler; > import com.google.gwt.user.client.Window; > import com.google.gwt.user.client.ui.Button; > import com.google.gwt.user.client.ui.RootPanel; > import com.google.gwt.user.client.ui.Label; > import com.google.gwt.user.client.ui.TextBox; > > /** > * Entry point classes define <code>onModuleLoad()</code>. > */ > > public class RulesEngineUI implements EntryPoint { > > public Connection conn= null; > > RulesEngineUI() > { > //establishing a database connection > > try > { > > Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); > String url = "<<url>>"; > conn = DriverManager.getConnection(url, "SYSTEM", "vindhya"); > // doTests(); > System.out.println("DONE!"); > conn.close(); > } > catch (Exception ex) {System.err.println(ex.getMessage());} > > } > private Button clickMeButton; > public void onModuleLoad() > { > > RootPanel rootPanel = RootPanel.get(); > > clickMeButton = new Button(); > rootPanel.add(clickMeButton, 232, 236); > clickMeButton.setText("Insert"); > > Label lblEmployeeId = new Label("Employee ID"); > rootPanel.add(lblEmployeeId, 30, 61); > > Label lblName = new Label("Employee Name"); > rootPanel.add(lblName, 26, 142); > > TextBox textBox = new TextBox(); > rootPanel.add(textBox, 233, 59); > > TextBox textBox_1 = new TextBox(); > rootPanel.add(textBox_1, 232, 142); > clickMeButton.addClickHandler(new ClickHandler(){ > public void onClick(ClickEvent event) { > Window.alert("Hello, GWT World!"); > } > }); > } > } > </code> > > Any help in this regard will be well appreciated. > > Thank you, > Vindhya > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-web-toolkit%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
