请教个问题。 我在远程的服务器上 建立了一个数据库,然后通过我的机器 把内容存到 服务器上的 表格里。怎么说,数据库不存在啊??可明明是有的,存在的。

解决方案 »

  1.   

    我用 dos  在我的机器上 远程在服务器上 建立了 数据库。。 然后在 本地 往服务器上的数据库 插入 记录。就报下面的错误。java.sql.SQLException: Table 'tom.tombbsData' doesn't exist
      

  2.   

    各个配置 ::: public static String USER_NAME = "mindworks";

    // public static String USER_PASSWORD = "123456";
    public static String USER_PASSWORD = "mindworks123456";

    public static String DB_URL = "jdbc:mysql://121.14.211.22:3306/tom";
      

  3.   

    public static String DRIVER = "com.mysql.jdbc.Driver";//   插入数据库的 程序 ::
    public  static void saveDB(String title, String context, String summary,
    String date, String url, String comefrom, String srcUrl,
    String tag, int type, Connection conn) {
    PreparedStatement pstmt = null;
    String dbName = "tombbsData";
    String spiderDate = getDate();
    String sql_str = "INSERT into "
    + dbName
    + " (title,content,type,summary,createTime,url,siteName,tag,siteUrl,spiderdate)values(?,?,?,?,?,?,?,?,?,?)";

    try
    {
    pstmt = conn.prepareStatement(sql_str);
    pstmt.setString(1, title);
    pstmt.setString(2, context);
    pstmt.setInt(3, type);
    pstmt.setString(4, summary);
    // pstmt.setTimestamp(5, getPageDate(date));
    pstmt.setString(5, date);
    pstmt.setString(6, url);
    pstmt.setString(7, comefrom);
    pstmt.setString(8, tag);
    pstmt.setString(9, srcUrl);
    pstmt.setString(10, spiderDate);
    pstmt.executeUpdate();
    conn.commit();
    }catch(Exception e)
    {
    e.printStackTrace();
    try {
    conn.rollback();
    } catch (SQLException e1) 
    {
    e1.printStackTrace();
    }
    }
    finally
    {
    try
    {
    pstmt.close();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    }
    }
      

  4.   

    如果连接测试没问题,,
    那~ 
    Table 'tom.tombbsData' doesn't exist
    数据库里没这个table叻
      

  5.   

    好,问题解决。原因是 我建的数据库中表名是 tombbsdata 而 存数据库的时候 表名为 tombbsData 一个大写D 的原因,可是我就不明白了。同样的程序,同样的数据库,(本地的也是 tombbsdata ) 。在本地能插入,可是到了,服务器,就插入不了。 请问是什么原因???