Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing GWT with mysql
    primarykey
    data
    text
    <p>I am new to GWT. I am trying to connect with a mysql server in it.</p> <p>Following is my project hierarchy:</p> <p>Project name is <code>hello</code> and package name is <code>com.hello</code>. By default GWT creates 3 folders that are</p> <ol> <li>com.hello.client</li> <li>com.hello.server</li> <li>com.hello.shared</li> </ol> <p>The main java file that contains entry point for GWT is in the com.hello.client folder by name of hello.java</p> <p>I have created a class db_conn (file name is db_conn.java) which contains all the required code to connect with mysql database. This file is placed in <code>com.hello.server</code> folder. Following is the code</p> <pre><code>package com.hello.server; import java.sql.Connection; import java.sql.DriverManager; public class db_conn { public Connection con; public db_conn() { } public String ConnectToDB() { try { String host = "localhost"; String db = "test"; String driver = "com.mysql.jdbc.Driver"; String user = "root"; String pass = "pwd"; Class.forName(driver).newInstance(); con = DriverManager.getConnection(host+db, user, pass); return "Connected to Database"; } catch(Exception ex) { return ex.toString(); } } } </code></pre> <p>In hello.java file (which is in com.hello.client folder and contains the main entry point for GWT) I have imported above class by <code>import com.hello.server.*;</code></p> <p>When I am trying to use the <code>ConnectToDB()</code> function from the <code>db_conn</code> class on <code>onModuleLoad()</code> in hello.java, it is giving me the following error:</p> <p><code>com.hello.server.db_conn 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.</code></p> <p>The code snippet window shows the db_conn class but when I use this class, it gives me error. I am not able to figure out the exact problem. Please help.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload