How do i create a new table from a *.sql file in JSP

<html>
<%@ page language="java" import="java.sql.*" %>
<%@ page errorPage="ExceptionHandler.jsp" %>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
String dbUrl = "jdbc:mysql://localhost/test?user=root";
Connection conn = DriverManager.getConnection(dbUrl);
Statement stmt = conn.createStatement();
stmt.executeUpdate("\\. addresses.sql");
%>
how would i create a table from the addresses.sql file?

stmt.executeUpdate("\\. addresses.sql");This, of course, will not work.
You might even execute it the same way you do from command line with some Runtime.exec() jugglery but I would suggest you to work with my first suggestion unless someone else came up with something better.

Similar Messages

  • How can I create a new table from a filed cell?

    Every time that I fill a row of cells I want to creat a new table with the content of that cells.
    How can I do it?
    Donw here it´s the example.
    From the top table, I want to fill these rows, and everytime that it´s done, I want that a new table apears like the cells under.
    There is any Way to do it?
    In the Spanish version of Number I found in the references formulas, one formula called "DIRECTION" that describes to do this.
    But I found no way to do it.
    The above formula it´s this:
    =DIRECCION(row; collumn; type of direction; stile of direction; table name)
    Anyone can help me?
    I really need this solution.

    Otto,
    Based on the syntax you quoted for that function, the english equivalent is "Address". It doesn't create a Table, but rather it creates an Address that references a Cell, in the form of a String. The common, and only, use that I am aware of for Address is to use it as the parameter for INDIRECT. For example: INDIRECT(ADDRESS)) will produce a reference to a table cell, but it will not produce a table.
    Jerry

  • Can you create a new table from an Excel spreadsheet

    It would be GREAT if there was a way to use SQL Developer to take an Excel Spreadsheet, and create a new table based on it - does anyone know if that's possible?
    Thanks,
    Brad Blake

    Excellent - yes, from the thread on the SQLDeveloper website, it looks like you will be able to create a new table from an .xls file - very cool!
    Does anyone know when version 1.1 is supposed to be coming out?
    --Brad                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Create a new table from another table that exists ussing a stored procedure

    Hi,
    I want to know if is posibble to create a new table from another table that exists ussing a stored procedure. This new table is created from other table that exists in the DB.
    (in the next code the table tbl1 exist into the schema of the DB, but temp_tbl1 does not exist, it must be created by the procedure)
    create or replace procedute temp is
    temp_tbl1 tbl1%TYPE; //the temp_tbl1 will have the same type of tbl1
    begin
    create table temp_tbl1 as (select * from tbl1);
    end temp;
    thanks very much

    cat wrote:
    Hello,
    I think my problem is not about this grant, because if I execute this as an "anonymous procedure":
    DECLARE
    BEGIN
    EXECUTE IMMEDIATE 'CREATE TABLE Abonus (id NUMBER, amt NUMBER)';
    END;
    It runs ok
    But if I do:
    CREATE OR REPLACE procedure temp as
    BEGIN
    EXECUTE IMMEDIATE 'CREATE TABLE Abonus (id NUMBER, amt NUMBER)';
    END;
    I have the error
    ORA-01031: Insufficient privileges
    ORA-06512: at "temp", line 3Anonymous blocks are treated as "Invoker's Rights" from a privilege perspective whereas stored programs by default are treated as "Definer's Rights". Therefore using anonymous blocks is not a valid test to check this.
    The simplest form of checking this issue is by executing
    SET ROLE NONE;and then to run your statement/code block in question interactively. Using this approach you get in your session the effective rights of a "Definer's Rights" stored program, i.e. only privileges that you got granted directly to your user.
    You can revert to the default setting by issuing
    SET ROLE ALL;For more information regarding this topic, read e.g. the documentation:
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/subprograms.htm#LNPLS00809
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • How can I create a new table in a MySQL database in MVC 5

    I have an MVC 5 app, which uses MySQL hosted in Azure as a data source. The point is that inside the database, I want to create a new table called "request". I have already activated migrations for my database in code. I also have the following
    code in my app.
    Request.cs: (inside Models folder)
    public class Request
    public int RequestID { get; set; }
    [Required]
    [Display(Name = "Request type")]
    public string RequestType { get; set; }
    Test.cshtml:
    @model Workfly.Models.Request
    ViewBag.Title = "Test";
    <h2>@ViewBag.Title.</h2>
    <h3>@ViewBag.Message</h3>
    @using (Html.BeginForm("SaveAndShare", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
    @Html.AntiForgeryToken()
    <h4>Create a new request.</h4>
    <hr />
    @Html.ValidationSummary("", new { @class = "text-danger" })
    <div class="form-group">
    @Html.LabelFor(m => m.RequestType, new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
    @Html.TextBoxFor(m => m.RequestType, new { @class = "form-control", @id = "keywords-manual" })
    </div>
    </div>
    <div class="form-group">
    <div class="col-md-offset-2 col-md-10">
    <input type="submit" class="btn btn-default" value="Submit!" />
    </div>
    </div>
    @section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    HomeController.cs:
    [HttpPost]
    public ActionResult SaveAndShare(Request request)
    if (ModelState.IsValid)
    var req = new Request { RequestType = request.RequestType };
    return RedirectToAction("Share");
    The point is that, I want the user to fill the form inside the Test view and click submit, and when the submit is clicked, I want a new entry in the new table to be created. But first of course I need to create the table. Should I create it using SQL query
    through MySQL workbench? If yes, then how can I connect the new table with my code? I guess I need some DB context but don't know how to do it. If someone can post some code example, I would be glad.
    UPDATE:
    I created a new class inside the Models folder and named it RequestContext.cs, and its contents can be found below:
    public class RequestContext : DbContext
    public DbSet<Request> Requests { get; set; }
    Then, I did "Add-Migration Request", and "Update-Database" commands, but still nothing. Please also note that I have a MySqlInitializer class, which looks something like this:
    public class MySqlInitializer : IDatabaseInitializer<ApplicationDbContext>
    public void InitializeDatabase(ApplicationDbContext context)
    if (!context.Database.Exists())
    // if database did not exist before - create it
    context.Database.Create();
    else
    // query to check if MigrationHistory table is present in the database
    var migrationHistoryTableExists = ((IObjectContextAdapter)context).ObjectContext.ExecuteStoreQuery<int>(
    string.Format(
    "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{0}' AND table_name = '__MigrationHistory'",
    // if MigrationHistory table is not there (which is the case first time we run) - create it
    if (migrationHistoryTableExists.FirstOrDefault() == 0)
    context.Database.Delete();
    context.Database.Create();

    Hello Toni,
    Thanks for posting here.
    Please refer the below mentioned links:
    http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/
    http://social.msdn.microsoft.com/Forums/en-US/3a3584c4-f45f-4b00-b676-8d2e0f476026/tutorial-problem-deploy-a-secure-aspnet-mvc-5-app-with-membership-oauth-and-sql-database-to-a?forum=windowsazurewebsitespreview
    I hope that helps.
    Best Regards,
    Sadiqh Ahmed

  • How do I create a new user, move my old files etc over, and delete old user

    This is why I think I need to.
    My computer got hit by lightening, and I may have created a new user account through netinfo rather than system preferences /accounts/+user. Mail used to open twice, but no longer. Now, Safari askes me for my keychain password twice, Spotlight can't find a folder on the computer when the search is restricted to folder and computer, though the folder is there and easyfind finds it, and when System Preferences/Spotlight/Privacy has the hard drive icon added, then deleted, Spotlight still does not find anything. (Yes, everything is backed up, on CD, DVD, and online.) Microsoft Tec Support says
    "Here is a summary of the key points of the case for your records.
    When you contacted us on August 8, you had requested assistance with Microsoft Office 2004, as your installation of the updates was unable to find the correct version of the software to update. After creating a New MAC User, we identified the issue to be with a corrupt MAC User account, and not a Microsoft issue. "
    I believe Microsoft. So, creating a new user was easy.
    But copying files uses up too much hard drive (movies, music), and may miss keychains, preferences, mail, address book, and documents. Since Spotlight no longer works, who knows what is happening. (Yes, I've repaired persmissions, and disk repair. No change). I'm using up my hard drive trying to move files to the new user. If I share files, or put them into a public folder, then delete the old user, will I still have the old user's files in the new user's account? It is not clear to me what I should be trying to do in order to create a new user, move my old files etc over, and delete old user. Thanks.
    My responses will be slow, because I have to drive to town to use the internet. I've ordered a new airport which may take care of that problem. SO be patient.

    Hey -
    I need to do the EXACT same thing, but have no idea how. Has anyone out there done this?
    My situation is a tad different..this is a new Mac (and I'm a brand new Mac user). Tons of querks occur under my original account (videos won't run, Safari won't support certain plug-ins). I spent 6 hours on the phone w/ 4 different Apple Reps and nobody could fix it. A rep finally looked at my MacBook Pro in person today. He created a new account just to see if that would work and under that new account, everything works perfectly fine (no querks, can view video). He tried switching a million settings in my original account to no avail.
    He said to create a new account (as he did) and move my files over to the new account and then go back to the original and delete it. How do you do this?! I can't figure it out! I've got a new account created, but of course it just has the default folders in it w/ the little red icons next to them! Thanks in advance!

  • How do I create a new table in Numbers '08 without them overlapping?

    I am using Numbers '08 and Mac OS X 10.8.2
    This is very basic but I want to create a bunch of consecutive tables in the same sheet. I want each table to be seperate and I want the title of the table to show above it. I have figured out how to do this for the first table, but each time I try to add a new table, it just overlaps the bottom of the first one.
    I want each table to have the same style as well so I don't have to keep adjusting the column width etc.
    I feel very silly for asking this but please help!!!

    Never mind, I figured it out!!!
    I selected the table, clicked on the small grey corner at the top left of the table and dragged the table to where I wanted it. So simple!!!

  • How do I create a new contact from the same company as one I already have

    How do I simply create multiple contacts from the same company? In Outlook this is achieved using by "New contact from same company". Is there a similar function in gMail contacts?

    Check that out with Gmail support.
    http://mail.google.com/support/

  • How can I create multiple QR Codes from an Excel File?

    Hi there,
    I am currently trying to set up business cards with a QR Code on the back of each card. Therefore I have an excel spreadsheet, which contains all the data necessary for the business card like name, function, e-mail adress,... the data is then filled in automatically by using the standard function with tags for each column (e.g. table column name is filled in as <<name>> in the specific location on the business card and once executed it is matched with the data from the excel file).
    Is there anything which could help me to automate the personalization of the QR Codes?
    All the best

    For free? Not at the moment. CC does have the ability to create QR codes but only one at a time. In CS6 (perhaps earlier versions?), regular poster/advanced scripter Jongware devised a script to prepare a QR code but again, could only do one at a time.
    However, someone did build on Jongware's QR code to do this from an InDesign file that had the necessary information in tagged text boxes and would prepare QR codes accordingly. However, it would leave them in the InDesign file (e.g. not separate EPS/PDFs).
    So, a long workaround would be:
    install the script and read the thread on the adobe forums (jongware's QR code plus the additional improvement): http://forums.adobe.com/message/4787823#4787823
    data merge the current data into the indesign file using the similar structure as the fourth poster in that post had written
    once all the QR codes are written, create a PDF of the file and then use one of various methods to break up the PDF into single page files: http://colecandoo.wordpress.com/2013/07/13/breaking-up-is-hard-to-do-indesign-files-into-i ndividual-pdfs-that-is/
    It's a lot of work to generate multiple QR codes. A paid solution offered by either Meadows DPS or Woodwing (two companies I have no affiliation with whatsoever) or any other plug-in provider for that matter: http://www.adobe.com/products/indesign/indepth.displayTab3.html may be an alternative that is worth pursuing.

  • Create multiple external tables from same flat file ?

    using oracle 10g
    currently create many external tables like so..
    CREATE TABLE "XT_UNITS"
    "Q1_2012" VARCHAR2(25 BYTE),
    "Q2_2012" VARCHAR2(25 BYTE),
    "Q3_2012" VARCHAR2(25 BYTE),
    "Q4_2012" VARCHAR2(25 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "XE_FILES" ACCESS PARAMETERS ( records delimited BY newline
    skip 1 fields terminated BY ',' OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES
    ARE NULL ) LOCATION ( 'xtunits.csv' ))
    is there any way I can use 1 flat file (csv) to populate many external tables ?
    maybe by section ?

    Jay wrote:
    using oracle 10g
    currently create many external tables like so..
    CREATE TABLE "XT_UNITS"
    "Q1_2012" VARCHAR2(25 BYTE),
    "Q2_2012" VARCHAR2(25 BYTE),
    "Q3_2012" VARCHAR2(25 BYTE),
    "Q4_2012" VARCHAR2(25 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "XE_FILES" ACCESS PARAMETERS ( records delimited BY newline
    skip 1 fields terminated BY ',' OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES
    ARE NULL ) LOCATION ( 'xtunits.csv' ))
    is there any way I can use 1 flat file (csv) to populate many external tables ?
    maybe by section ?Not a logical question.
    An external table definition relates to one or more files.
    You could probably create multiple externable table definitions to access the same file(s), but you may end up with some operating system file locking issues if you're not careful, and to be honest why would you need to do that?

  • How do I create a new event from a section of a long video clip

    When I try to select a section of a long clip and drag it to a new event in the iMovie event library, the whole clip moves into the new event.  Isn't there a way to just select and move a section to the new event?

    This does work, but the process is crushingly difficult for my mother. (Try to explain to a 60 year old that you need to reveal the clip in finder. Trim it, save it, trim it, save it, etc for each part of the video. Then re-import those clips into iMovie and delete the original large file from your events). This could have been accomplished with one keyboard shortcut or menu command.
    I'm opposed to creating projects to organize events because it doesn't make sense when creating a Christmas montage to open a project and look for a clip then find it in the events when you could otherwise just look through Christmas 1984 and pull the clip you want. It creates a dual paradigm.
    More than anything I want to attract Apple to this glaring flaw in their product. I can't see the downside of in-app splitting of events which was a feature of iMovie v9. Why remove it entirely? I know it's a rarely used feature, it could have been suitably hidden to avoid accidents. It wouldn't frustrate the average user, but it has confused the ever-living **** out of my mother.

  • How do I create a screen saver from a video file?

    I've been trying to search for an answer to this question for 20 minutes, without luck, so I figured the best course of action is to ask the experts.
    I'm a video editor.  If I cut together a series of clips, of any length, how do I make that movie into a screen saver that will be usable on OS X Lion and Windows XP?  I would assume that it's just a matter of converting the movie file to something that an operating system recognizes and will play as a screen saver (on both platforms), but I cannot Google my way into finding the answer... I'm wanting to make a video screen saver for my wife for Christmas.  PLEASE HELP!!!
    Thanks.

    Hi,
    Welcome to the Apple Discussions.
    There are a few tools you can use. This page lists a couple. It looks like you can download a trial version and see if it'll do what you want. If not there's another one on that page.
    If you're handy with programming, you can also create your own with Xcode. There's an article here that talks about it, though it's a bit old, and might be somewhat out of date.
    But just dropping SWF files probably isn't going to work. A screen saver is a special kind of program...
    charlie

  • Acrobat X having issues particularly in regard to creating a new form from an imported file.

    So here's the dealio. I'm trying to update an online for. I've made them in the past with no issues. Now I need to add a few liability lines. Anyway, So as per the video, I try to create a form from the updated pdf which was created through Word.  I can't make any headway. Also as per the video you can see that Acrobat won't close from the dialogue box, only from the menu bar. Not sure what's up with my software.
    Acrobat Pro X
    OSX on a Mac Mini

    The password is password BTW

  • How can I create a Document object from a text file (myFile.txt)

    Hi everybody:
    Thank you for reading this message.
    I am trying to find a method to convert a text file ( I have it in a File object) to a Document object.
    I read the Java API but it is strange, I do not know if I have to create an AbstractDocument, it is really strange for me.
    Any comment is welcome,
    Regards,
    JB

    Document is an interface, and AbstractDocument is abstract, so you
    can't create either of those directly. Assuming you are dealing with a
    a plain text file, you could do something like
    // Not catching any exceptions that get thrown
    File file = /* file you already have */
    String eol = System.getProperty( "line.separator" );
    int eolLen = eol.length();
    FileReader reader = new FileReader( file );
    BufferedReader buffer = new BufferedReader( reader );
    PlainDocument doc = new PlainDocument();
    for ( String line = buffer.readLine() ; line != null ; line = buffer.readLine() ) {
        int len = doc.getLength();
        if ( len > 0 ) {
            doc.insertString( len, eol, null );
            len += eolLen;
        doc.insertString( len, line, null );
    }and now you have a document.
    : jay

  • How can I create a custom shape from a TIFF file?

    I have a logo as a tiff file that I am trying to use as a watermark. I figured out how to insert it onto another picture through File > Place... however i then couldn't figure out how to change the colour of the watermark. Any pointers would be much appreciated!

    Which version of photoshop elements are you using?
    What color is the logo now?
    Can you post an example of the logo?

Maybe you are looking for