JBDC - Check if table exists?

Discussion in 'Plugin Development' started by herghost, Nov 14, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    herghost

    Hi all,

    I have recently started using the JBDC (10 mins ago :p) and was wondering if anyone could tell me how to check if a table exists, even if it is empty?

    What I am trying to do

    Code:
    try
      {
        sqlFunctions method = new sqlFunctions();
        method.check_tablesExist();
        //if not
        method.create_tablesConnect();
        //else
        ---continue ----
        } 
    I can create tables successfully, however I want to check they exists before attempting to create them.

    Many Thanks
     
  2. Offline

    Daniel Heppner

    What do you plan on using it for? Databases should be avoided unless you absolutely need them.
     
  3. Offline

    Father Of Time

    Do it in the SQL query itself:

    Code:
    CREATE TABLE IF NOT EXISTS 'tablename' ('Variable1' VARCHAR(100) )
     
Thread Status:
Not open for further replies.

Share This Page