Quartz + mysql confused..

Hey guys,
I just start to use quartz yesterday. and i got a problem here.
i followed the other people's post to construct quartz.properties as this:
# Configure Main Scheduler Properties
org.quartz.scheduler.instanceName = TestScheduler
org.quartz.scheduler.instanceId = one
# Configure ThreadPool
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 4
# Configure JobStore
org.quartz.jobStore.misfireThreshold = 5000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_
# Configure Datasources
org.quartz.dataSource.myDS.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.myDS.URL = jdbc:mysql://localhost:3306/sitemapper
org.quartz.dataSource.myDS.user = root
org.quartz.dataSource.myDS.password = root
org.quartz.dataSource.myDS.maxConnections 5
the quartz tables are created by quartz's tables_mysql.sql. i can see those tables are good in mysql db server.
my testing job will be very easy, just make it display "hello" every second every day.
and here is the code:
package test;
import org.quartz.*;
public class QuartzReport implements Job
public void execute(JobExecutionContext cntxt) throws JobExecutionException
System.out.println("Hello"
+ cntxt.getJobDetail().getJobDataMap().get("type"));
public static void main(String[] args)
try
SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();
Scheduler sched = schedFact.getScheduler();
sched.start();
JobDetail jobDetail = new JobDetail("Income Report",
"Report Generation", QuartzReport.class);
jobDetail.getJobDataMap().put("type", "FULL");
CronTrigger trigger = new CronTrigger("Income Report",
"Report Generation");
trigger.setCronExpression("* * * * * ?");
sched.scheduleJob(jobDetail, trigger);
catch (Exception e)
e.printStackTrace();
but how can i add this frequency and job in the database out there?? i am confused. please help me. many thanks!

Hi JbloodH,
You are on the way.
I beleive you have configured your 'Quartz.properties' file properly.
Now your next step should be Just run your Job and Quartz will automatically manage your database for you. As soon as you start your 'Scheduler', you find one row inserted into both 'qrtz_triggers' and 'qrtz_job_details'
Hope this may helpful to you.
Allwyn

Similar Messages

  • Confused, which MySQL database to connect to: local (WAMP), or remote?

    Hello, new to dynamic sites, have successfully installed WAMP and set up my local/testing/remote sites in DW CS4.  Most tutorials I've found recommend making the "MySQL Connection" in Dreamweaver to the local (WAMP) installation of MySQL, which I am able to do.  But my remote site already has an existing MySQL database and tables.  So should I be making the MySQL Connection to the remote database instead?  Or exporting the remote server's database and importing it locally for development purposes?  What's the best practice?
    If making the connection to my local database is recommended, how do I transfer any changes that I make on my local db to the remote database?  Do I need to export locally & import to the remote db, using phpmyadmin, every time I make changes to the local database?
    If making the connection to my remote database is recommended, I have 2 questions: 1) do I even need my local WAMP MySQL database for anything?  and 2)  I was able to connect to my remote MySQL, (first got "MySQL ERROR 1045 Access Denied", but then went into my remote server via CPanel, found the "Remote MySQL" function, and entered my long current domain name as a new Access Host), but since I'm at a home office without a static IP, will I have to keep going into CPanel and entering in a new Access Host every time my IP address changes?
    Apologies for the confusion.  Any pointers to recommended best practices would be much appreciated.
    - Frank

    > 2)  I was able to connect to my remote MySQL, (first got "MySQL ERROR  1045
    > Access Denied", but then went into my remote server via CPanel,  found the
    > "Remote MySQL" function, and entered my long current domain  name as a new
    > Access Host), but since I'm at a home office without a static IP,
    > will I have to keep going into CPanel and entering in a new  Access Host every time
    > my IP address changes?
    Update: my IP address changed slightly yesterday and I was denied remote MySQL access again.  Went back to CPanel and modified my Access Host domain with a few wildcard characters (blah-blah-blah-%%%%.dsl.bell.ca).  That got me back in.  Is this what most people who want remote MySQL access do?  Is it a (significant) security risk?
    Or do most people without static IPs just not bother with remote MySQL access?

  • Confused about the instructions for installing MySQL on my OS X client

    I installed MySQL for OS X as recommended here:
    http://developer.apple.com/internet/opensource/osdb.html
    it looks like I managed to created a test database in the mysql directory, but now can't access it.
    Basically, I'm confused about what to do after installing the MySQL server about setting permissions, getting databases to be where I want them to be, etc.
    I tried download phpMyAdmin, since I am used to using that via cPanel on my ISP, but don't know how to use it on my Mac. Do I need to start up Apache to do that? And if I do that, won't it interfere with the mongrel server that I'm trying to use in the separate Ruby on Rails instructions?
    I guess I could probably do all my development online via my ISP, which supports Ruby on Rails and where it is easy to set up MySQL databases, but if I could just figure out how to use MySQL on my Mac it would be fun to try to do this development offline.
    Any hints?
    Thanks,
    doug

    Have you done anything past those instructions? like creating MySQL user accounts, granting permissions, etc?
    There's a whole lot more to running MySQL that just installing it (and I'm not sure why Apple suggest building from scratch when MySQL offer binary distributions which do all the hard work for you.
    Once installed you should follow the MySQL Post Install Instructions for guidance on setting up accounts and configuring MySQL.
    As for the PHPMyAdmin question, yes, you'll need Apache running. Whether that will conflict with any other web services you're running depends on how they're configured. I've never heard of mongrel to be able to advise further there.

  • Quartz Composer effects render blank white video - confused re Core Image

    I've tried the Quartz Composer effects in iMovie 6 but they preview as blank white video and when I apply the effect they render as blank white video.
    Here's my video config:
    Chipset Model: ATY,RADEON
    Type: Display
    Bus: AGP
    Slot: SLOT-A
    VRAM (Total): 32 MB
    Vendor: ATI (0x1002)
    Device ID: 0x5144
    Revision ID: 0x0000
    ROM Revision: 113-74901-224
    Displays:
    Acer AL1912:
    Resolution: 1152 x 870 @ 75 Hz
    Depth: 32-bit Color
    Core Image: Not Supported
    Main Display: Yes
    Mirror: Off
    Online: Yes
    Quartz Extreme: Supported
    After reading this page:
    http://www.apple.com/support/imovie/hottips/
    I see that the Quartz Composer effects are supported only for Core Image supported video cards. I think that means I'm out of luck. It seems odd that the effects still attempt to render and be applied even if my system doesn't support them. Is something wrong with my installation, or is this expected behavior?
    I've seen statements here on the discussions that Quartz Extreme should enable effects like the ripple when opening or closing Dashboard Widgets. My card does support Quartz Extreme but I do not see the ripples. I'm guessing that it's actually Core Image that produces those effects and that's why I don't see them. Is that a correct guess?
    I guess I'm confused over the difference between Quartz Extreme and Core Image.
    Thanks for clearing up my confusion...

    Quartz Extreme, as I understand it, is used by OS X for drawing windows
    That is true. Quartz Extreme is a special, hardware accelerated instance of Quartz. Quartz is OS X's native drawing environment. When Quartz Extreme is not supported, Quartz will be used instead.
    Quartz Composer is something else that builds on Quartz. It appears it requires Core Image. Core Image is a set of graphics routines that allow image manipulation (if you have the developer package installed, you can also find an application called 'Quartz Composer' that you can use to define effects, screensavers etc).
    Core Image also intents to leverage your GPU. Apple's Documentation alleges that if there is no GPU available it will use the CPU instead. Theoretically, your Mac should support Core Image. Yet...
    From Dennis' System specs:
    Core Image: Not Supported
    This may be the reason why you can't use these effects in iMovie. Because of shortcomings in iMovie's plug-in API, the plug-ins may still show up in the f/x panel - they simply will not function when selected.
    Perhaps a later version of OS X enables CoreImage on all Macs?
    Hope this helps,
    -ch
    Please Note:
    I work for cf/x, and may profit from posting here.

  • So confused with Mac's web server MYSQL setup

    I'm a recent Mac convert, and while I use to install apache~php~mysql on my PC I've been enjoying my pre-installed apache~php~mysql on my Mac... except one thing, I have no idea how to access MYSQL. I did a phpinfo(); check and it says that MYSQL has been enabled. I installed Sequel Pro to help manage MYSQL databases, but I can't log in. What's the default username and password? I just need to fill the following in:
    Name:
    Host:
    Username:
    Password:
    Any amount of help would be great, thanks in advance~!

    Try the Unix forum under OS X Technologies.

  • Confused between javadb + mysql + related

    Hello --
    I downloaded a package with netbeans and included a few things. I booted up glassfish and enabled the javadb and can connect to it successfully with netbeans. But ... how do I view the database? Do I need mysql to view the databases? Can I use mysql with javadb? Is javadb just the database and has no visual gui of the database itself?
    I'm very sorry -- i used to be good at this stuff, but it's been a while .. please help clarify for me :) thx

    JavaDB and MySql are two entirely different databases. So using them together is like saying you want to use a Ford Edsel and a Toyota Prius together. There are situations where they might interact but on the whole they go on their separate ways.
    Databases don't have GUIs per se. Not everything you could ever want to use will require a human interface. However there are often GUI tools that connect to databases, usually distributed as part of a toolset along with the database.
    It's possible that NetBeans comes with some kind of database viewer app, or has a plugin available to do so. Don't know.
    This link looks helpful:
    http://www.netbeans.org/kb/docs/ide/java-db.html

  • I can't get my website to connect to mysql database hosted on my yahoo site

    I used David Powers tutorials to build a CMS website in Dreamweaver using a testing site set up on my computer. I installed XAMPP and got it working on my computer. (I have a Windows 7 PC with Dreamweaver CS6)
    Now I have installed the mysql database on my remote site following the instructions in the help section of Yahoo Small Business, where my website is hosted. I recreated the same database on the myPHPAdmin on my remote site. (If I understood what I found out when searching for a solution, Yahoo doesn't allow me to see the database from Dreamweaver. It seems that I have to make sure the connections are correct and then upload my site to the remote server. Then it should work once up)
    Following the instructions I could find on Yahoo it seems that all I needed to do was make sure that the user name and password were the same as on my local computer and change the my Sql Server in the Server Connection in Dreamweaver CS6 to mysql instead of localhost, upload my website and it should connect. When I go to my webpage online I get "No database selected".
    I know html, css, some php, and mysql.
    I have been using Dreamweaver for approximatley 2 years and have created 2 successful websites for my husband, who is a photographer. He now wants to have a blog type news website and since I couldn't get Wordpress to do what he wanted to do I decided to create a CMS website. It works great on my computer, but now I need it to work on my remote site.
    I know it's probably something really stupid that I have overlooked and I would really appreciate any help I could get.
    I'm more than happy to learn whatever I need to learn to get this done. I have been searching all kinds of forums and I can find a lot of posts about this or a similar problem, but no solutions.
    Please let me know if I need to provide more information.

    I'm sorry, the way I wrote that was confusing. In mysql it suggested you create a new user that had limited access to access each database you created, rather than use the root user which had all permissions. So in both the mysql on my computer and the mysql on my website I created a user with the same username and password, so that when my website was on my remote server the username and password were the same as when I was testing it on my local computer.
    SnakEyez02 wrote:
    Following the instructions I could find on Yahoo it seems that all I needed to do was make sure that the user name and password were the same as on my local computer and change the my Sql Server in the Server Connection in Dreamweaver CS6 to mysql instead of localhost, upload my website and it should connect. When I go to my webpage online I get "No database selected".
    Just looking at that part of your response, I don't get what they are asking you.  Typically the remote host will require that you update the username/password and possibly SQL server.  When you are in most shared environments, which is what I presume you are in, you typically have a username that is prefix_username.  So you should be updating your script to match that information, not the other way around.  Also with the "mysql instead of localhost" comment, you would only change the script from localhost to another server (ip address) if the mySQL server is not on your web server.  If you host tells you this is true thent he value should be an IP address instead of localhost.  Is that the case?
    For the second part of your question in the "Why can't I access my database" help on Yahoo it says "If your PHP or Perl configuration files require a host name, you may have a problem with your host name. Make sure that you are using the host name mysql, not the default host name localhost." I assumed that meant that in the setup menu when establishing a server connection I needed to replace "localhost" as the mysql Server with "mysql" and then upload my website. This didn't work. Since the mysql server I am trying to access can be accessed using phpmyadmin at www.mywebsite.com/phpmyadmin this seemed to make sense to me. I think I might have managed to access the mysql server, but I'm not choosing the database I want correctly.

  • How can i display data from mysql (cant do it using netbeans)

    im confused with changing ResultSet-->List->Array;
    i already done displaying a data table from mysql but im lost on how to display mysql rows to ComboBoxes and JLists...
    im new here.
    how does the setModel() work?
    i hate this GUI stuff.. = (
    thanks...

    im new here.
    how does the setModel() work?
    i hate this GUI stuff.. = (You claim you have JDBC working already, if I understand your post correctly. So you're asking a question about GUIs in the JDBC forum. Not a good strategy. Try the Swing forum.

  • MySQL : works in the IDE, but not when i launch the webapp

    Hello,
    when i setup a mysql connection, everything seems to be ok in the IDE, i can see my datasource, i can open my tables, see the content, etc. But when i click on the green arrow to deploying and testing my webapp, the server returns me a very long error page : javax.faces.FacesException: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: com.mysql.jdbc.Driver
    What should i do ?
    thanks.
    PS : the entire error page is here, http://gpglinux.free.fr/error.html

    Hello,
    Can you give me the full path to where you placed the mysql jar?
    I just installed 6.1 and it is confusing in its directory structure.
    Thanks
    Frank

  • Problems using Quick Migrate in SQL Developer 1.5 for MySQL to Oracle 10g

    Hi all,
    I am trying to use SQL Developer 1.5 migration tools (Quick Migrate) to perform online capture and build source model to migrate from MySQL 5.x to Oracle 10g on Windows platform. I get these errors and the Quick Migrate process fails:
    oracle.dbtools.metadata.persistence.PersistableObject.doInsert(PersistableObject.java:238)
    I did a search and used the sqldeveloper.cmd script but still fails. Then I created a new database and truncated the repository. I now get the above error plus two new ones listed below:
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    Error loading nls:OALL8 is in an inconsistent state
    Error occurred during capture: Protocol violation
    It fails during the capture process for MySQL 5.1 database
    when it begins to capture the tables from MySQL.
    Does anyone know how to resolve these issues when migrating from MySQL to Oracle 10g using Quick Migrate with SQL Developer 1.5 release?
    Regards,
    Ben Prusinski
    Message was edited by:
    benprusinski
    Message was edited by:
    benprusinski

    Hi all,
    I put the following in my sqldeveloper.cmd file:
    SET ORACLE_HOME=%CD%
    What is very confusing is that with SQL Developer 1.5, there are several levels and several SQL Developer executables! I am really not sure which of these to use:
    I created the SQLDeveloper 1.5 directory called SQLDeveloper1_5 on Windows:
    1) cd C:\sqldeveloper1_5\sqldeveloper-5338
    there exists a sqldeveloper.exe
    2) cd c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloper.exe
    3) cd c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloer\bin\sqldeveloper.exe
    Which SQLDeveloper 1.5 executable should I be using and where should I place the
    sqldeveloper.cmd file?
    Also I did try to use a different database and schema for the repository with Quick Migrate but it appears a bug exists in SQL Developer 1.5 version that causes errors with Quick Migrate for MySQL to Oracle? Is this correct?
    As an update, I ran the following commands:
    cd to
    c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloper\bin
    sqldeveloper.cmd sqldeveloper.exe
    Start sqldeveloper.exe
    Perform standard capture for MySQL using the new mig2 schema as the new repository
    It starts the capture but fails on the errors below:
    Error loading nls:OALL8 is in an inconsistent state
    UPDATE
    ============================
    I tried this again and it worked with the exception of one error message listed below:
    Here are the steps that I followed:
    1. Create a Windows cmd script
    Put the following entries in the script:
    SET ORACLE_HOME=%CD%
    save the command windows script as sqldeveloper.cmd
    Copy this script to the base installation directory for SQLDeveloper
    Example:
    1. cd c:\SQLDeveloper1_5\sqldeveloper-5338\sqldeveloper
    2. Start SQLDeveloper with the command script that you created earlier
    Example:
    Open a Windows shell prompt window and execute the following scripts:
    a) sqldeveloper.cmd sqldeveloper.exe
    b) sqldeveloper.exe
    3) In SQL Developer 1.5
    From the Migrate menu,
    a) Delete current repository and create a new schema in Oracle target database call it mig2.
    b) Then create a new repository in SQL Developer 1.5
    c) Right mouse click on the MySQL 5.x database and choose capture
    It worked with the exception of one error message:
    o.jdbc.driver.OracleDriver     
    Error while registering Oracle JDBC Diagnosability MBean.
    So it looks like something is screwed up with my JDBC drivers and configuration for MySQL. How do I diagnose the JDBC driver issue for MySQL?
    Thanks!!!
    Ben
    Thanks
    Ben

  • Upload image into mysql database residing on  remote server is not working?

    hello to all,
    i need ur help,we hav online site .
    i have to upload image(which can b from any pc) into mysql database residing on remote server of which we (don't hav actual path of that server).
    the solution i'm using is working correctly on local bt when transfer it to server it shows
    java.io.FileNotFoundException: (No such file or directory)
    i have used multipartRequest to access parameter of file type input.
    all variables and related packages r imported properly.no prblm in that.
    code is here....................................
    try {
    MultipartRequest multi = new MultipartRequest(request, ".", 500000 * 1024);
    File f = multi.getFile("uploadfile");
    out.println(f.getName());
    filename = f.getName();
    String type = multi.getContentType(f.getName());
    fis=new FileInputStream(filename);
    byte b[]=new byte[fis.available()];
    fis.read(b);
    fis.close();
    Blob blob=new SerialBlob(b);
    Class.forName("com.mysql.jdbc.Driver");
    Connection con=DriverManager.getConnection("jdbc:mysql://10.1.52.206:3306/test?user=root&password=delhi");
    String query="insert into uploads (FILENAME,BINARYFILE,) values (?,?)";
    pstmt=con.prepareStatement(query);
    pstmt.setString(1,filename);
    pstmt.setBlob(2,blob);
    int i=pstmt.executeUpdate();
    if(i>0)
    out.println("Image Stored in the Database");
    else
    out.println("Failed");
    } catch (Exception ex) {
    out.print("*******************"+ex);
    ex.printStackTrace();
    please suggest me the way to upload image to remote server** not on local server.
    its urgent.
    Edited by: JavaDevS on Jul 28, 2008 11:41 AM

    i need ur help,we hav online site .Please don't use these juvenile abbreviations. It's impolite when you're asking for assistance not to make the effort to spell out all of the words. Moreover in a forum with an international readership the use of standard English will reduce the possibility of confusion.
    I presume that your file upload is being placed in a different directory from that which you were expecting. I would suggest logging all paths (specifically filename) to see if this is an unexpected value.
    Please explain further what you mean by "local" - is this a stand-alone application, or merely running a copy of the server on your local machine and doing the transfer (via the browser) to that? Are there any other differences such as the browser used?

  • How do I install Quartz Composer on my imac 7-27"??

    I am trying to get into Quartz Composer and I am very confsed since imac 7-27' doesn't come with a cd-instal anymore. I tried to do online, installing xcode 4 from the apple site, but at some point it says that i never used itunes store and ask me for my billing details...it's confusing since Quartz Composer is a free aplication. Any ideas on how to dwonload this. On SnowLeopard you can do it through your instal cd, But how to do it in Lion????
    Much appreciated!!

    You need to provide billing information to DL from the App Store, whether or not you buy anything. That's the only way to get anything, including free stuff, from the App Store.

  • Any Good link for mysql Installation in solaris 10?

    Please share with me good link for mysql, Tomcat installation(latest version)
    I found http://instmysql5sol10.blogspot.com/ in internet but not able to download "Download the packages (both Standard and Max) and save them in an appropriate directory".

    alan.pae wrote:
    attempted to install Solaris on it. Everything goes OK but I am confused by an info message that I get upon booting the system from CD:
    SunOS Release 5.10 Version Generic_137138-09 *32-bit* You got it installed and then you booted from the CD???
    If you booted from the hard disk then run:
    isainfo -kv
    alanNo, of course not. It isn't installed yet. I meant that I booted the
    computer from from the install DVD to start the installation process.
    But thanks for the info. I'll install it and will run this command.

  • Help on locking MySQL tables (many can read, but only one can write) Java

    Hi there,
    I have a question regarding locking of tables so that only one person can write to the file, but many are able to read the files (or tables entities).
    I am not sure if I need to lock the tables in my Java code or do I lock the tables within the MySQL syntax. I'm just a little confused on the matter.
    This java code is a working prototype of inserting a customer data into the database and that works fine. I just don't know how to implement it so that only one person can update the table at a time.
    Here is the Customer.java code that I have written.
    Help would be greatly appreciated, thanks so much.
    package business;
    //~--- non-JDK imports --------------------------------------------------------
    import shared.info.CustomerInfo;
    //~--- JDK imports ------------------------------------------------------------
    import java.sql.*;
    * @author
    public class Customer {
        static Connection    con  = DBConnection.getConnection();
        private CustomerInfo info = new CustomerInfo();
        private String               customerID;
        private String               firstName;
        private String               lastName;
        private String               email;
        private String               addressID;
        private String               homePhone;
        private String               workPhone;
        private String               unitNum;
        private String               streetNum;
        private String               streetName;
        private String               city;
        private String               provinceState;
        private String               country;
        private String               zipPostalCode;
        public Customer(String id) {
            try {
                PreparedStatement pstmt = con.prepareStatement("SELECT * FROM " +
                        "Customer NATURAL JOIN Address WHERE CustomerID = ?");
                pstmt.setString(1, id);
                ResultSet rs = pstmt.executeQuery();
                while (rs.next()) {
                    customerID    = rs.getString("CustomerID");
                    firstName     = rs.getString("FirstName");
                    lastName      = rs.getString("LastName");
                    homePhone     = rs.getString("HomePhone");
                    workPhone     = rs.getString("WorkPhone");
                    email         = rs.getString("Email");
                    city          = rs.getString("City");
                    provinceState = rs.getString("ProvinceState");
                    country       = rs.getString("Country");
                    zipPostalCode = rs.getString("ZipPostalCode");
                    unitNum       = rs.getString("UnitNum");
                    streetNum     = rs.getString("StreetNum");
                    streetName    = rs.getString("StreetName");
                    addressID     = rs.getString("AddressId");
            } catch (SQLException e) {
                e.printStackTrace();
            info.setCustomerID(customerID);
            info.setFirstName(firstName);
            info.setLastName(lastName);
            info.setHomePhone(homePhone);
            info.setWorkPhone(workPhone);
            info.setEmail(email);
            info.setCity(city);
            info.setProvinceState(provinceState);
            info.setCountry(country);
            info.setZipPostalCode(zipPostalCode);
            info.setUnitNum(unitNum);
            info.setStreetNum(streetNum);
            info.setStreetName(streetName);
            info.setAddressID(addressID);
        public static void addCustomer(CustomerInfo cust) {
            try {
                int id = -1;
                PreparedStatement pstmt = con.prepareStatement("INSERT INTO Address" +
                        "(UnitNum, StreetNum, StreetName, City, ProvinceState, Country," +
                        " ZipPostalCode) VALUES(?, ?, ?, ?, ?, ?, ?)");
                pstmt.setString(1, cust.getUnitNum());
                pstmt.setString(2, cust.getStreetNum());
                pstmt.setString(3, cust.getStreetName());
                pstmt.setString(4, cust.getCity());
                pstmt.setString(5, cust.getProvinceState());
                pstmt.setString(6, cust.getCountry());
                pstmt.setString(7, cust.getZipPostalCode());
                pstmt.executeUpdate();
                ResultSet rs = pstmt.getGeneratedKeys();
                rs.next();
                id = rs.getInt(1);
                pstmt = con.prepareStatement("INSERT INTO Customer" +
                        "(FirstName, LastName, HomePhone, WorkPhone, Email, AddressID)"
                        + "VALUES(?, ?, ?, ?, ?, ?)");
                pstmt.setString(1, cust.getFirstName());
                pstmt.setString(2, cust.getLastName());
                pstmt.setString(3, cust.getHomePhone());
                pstmt.setString(4, cust.getWorkPhone());
                pstmt.setString(5, cust.getEmail());
                pstmt.setInt(6, id);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
        public void setFirstName(String newName) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET FirstName = ? WHERE CustomerID = ?");
                pstmt.setString(1, newName);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            firstName = newName;
        public void setLastName(String newName) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET LastName = ? WHERE CustomerID = ?");
                pstmt.setString(1, newName);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            lastName = newName;
        public String getFirstName() {
            return firstName;
        public String getLastName() {
            return lastName;
        public void setHomePhone(String number) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET HomePhone = ? WHERE CustomerID = ?");
                pstmt.setString(1, number);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            homePhone = number;
        public String getHomePhone() {
            return homePhone;
        public void setWorkPhone(String number) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET WorkPhone = ? WHERE CustomerID = ?");
                pstmt.setString(1, number);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            workPhone = number;
        public String getWorkPhone() {
            return workPhone;
        public void setEmail(String email) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer" + " SET Email = ? WHERE CustomerID = ?");
                pstmt.setString(1, email);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            this.email = email;
        public String getEmail() {
            return email;
        public void setUnitNum(String num) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET UnitNum = ? WHERE AddressId = ?");
                pstmt.setString(1, num);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            unitNum = num;
        public String getUnitNum() {
            return unitNum;
        public void setCity(String city) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET City = ? WHERE AddressId = ?");
                pstmt.setString(1, city);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            this.city = city;
        public String getCity() {
            return city;
        public void setStreetNum(String num) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET StreetNum = ? WHERE AddressId = ?");
                pstmt.setString(1, num);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            streetNum = num;
        public String getStreetNum() {
            return streetNum;
        public void setStreetName(String name) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address"
                                              + " SET StreetName = ? WHERE AddressId = ?");
                pstmt.setString(1, name);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            streetName = name;
        public String getStreetName() {
            return streetName;
        public void setZipPostalCode(String code) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address"
                                              + " SET ZipPostalCode = ? WHERE AddressId = ?");
                pstmt.setString(1, code);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            zipPostalCode = code;
        public String getZipPostalCode() {
            return zipPostalCode;
        public CustomerInfo getInfo(){
            return info;
        static void deleteCustomer(String customerId) {
            try{
                PreparedStatement pstmt = con.prepareStatement("DELETE FROM Customer" +
                        " WHERE CustomerId = ?");
                pstmt.setString(1, customerId);
                pstmt.executeUpdate();
            }catch(SQLException e){
                e.printStackTrace();
        static void updateCustomer(CustomerInfo custInf) {
            try{
                PreparedStatement pstmt = con.prepareStatement("UPDATE customer" +
                        " SET firstName = ?, SET lastName = ?," +
                        " SET homePhone = ?, SET workPhone = ?, SET email = ?" +
                        " WHERE CustomerId = ?");
                pstmt.setString(1, custInf.getFirstName());
                pstmt.setString(2, custInf.getLastName());
                pstmt.setString(3, custInf.getHomePhone());
                pstmt.setString(4, custInf.getWorkPhone());
                pstmt.setString(5, custInf.getEmail());
                pstmt.setString(6, custInf.getCustomerID());
                pstmt.executeUpdate();
                pstmt = con.prepareStatement("UPDATE address" +
                        " SET unitNum = ?, SET StreetNum = ?, SET StreetName = ?," +
                        " SET city = ?,SET Province = ?,SET country = ?,SET ZipPostalCode = ?" +
                        " WHERE AddressId = ?");
                pstmt.setString(1, custInf.getUnitNum());
                pstmt.setString(2, custInf.getStreetNum());
                pstmt.setString(3, custInf.getStreetName());
                pstmt.setString(4, custInf.getCity());
                pstmt.setString(5, custInf.getProvinceState());
                pstmt.setString(6, custInf.getCountry());
                pstmt.setString(7, custInf.getZipPostalCode());
                pstmt.setString(8, custInf.getAddressID());
                pstmt.executeUpdate();
            }catch(SQLException e){
                e.printStackTrace();
    }In addition, here is my customer sql table.
    -- Table structure for table `customer`
    DROP TABLE IF EXISTS `customer`;
    CREATE TABLE `customer` (
    `CustomerID` mediumint(9) NOT NULL auto_increment,
    `FirstName` varchar(20) NOT NULL,
    `LastName` varchar(20) NOT NULL,
    `HomePhone` varchar(11) NOT NULL,
    `WorkPhone` varchar(11) default NULL,
    `Email` varchar(20) NOT NULL,
    `AddressID` mediumint(9) default NULL,
    PRIMARY KEY (`CustomerID`),
    KEY `AddressID` (`AddressID`),
    CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`AddressID`) REFERENCES `address` (`AddressID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    -- Dumping data for table `customer`
    LOCK TABLES `customer` WRITE;
    /*!40000 ALTER TABLE `customer` DISABLE KEYS */;
    /*!40000 ALTER TABLE `customer` ENABLE KEYS */;
    UNLOCK TABLES;

    to the best of my knowledge, this is something related to the database and not the programming. If you'd want to be the only user to read and edit the table, speicify only one user with that privilege and make it password protected. User must enter the password to write to the tables.

  • Connection to mySQL via jdbc

    I'm currently programming a GUI to access a database. Therefore I executed a query, which worked fine. But when I tried to exit my program with
    System.exit(0)my DOS-Prompt crashes without exiting.
    Now I tried it with a kind of minimalistic Connection like that:
    Class.forName("org.gjt.mm.mysql.Driver");
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/stock");     
    conn.close();Here the same problem occurs, so it must be the Connection that causes the error.
    If I would exit the program right away after the Connection, that is
    Class.forName("org.gjt.mm.mysql.Driver");
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/stock");     
    conn.close();
    System.exit(0);then the program exits properly. Unfortunately it doesn't make any sense to quit the program right after reading the data.
    So, as you can guess, I'm quite confused. I used the same driver and the same database in another program on the same computer, and it works fine. So I'm left totally clueless.
    I'm not using a special programming environment, I just write my code using UltraEdit. I've got installed Java 1.4.0 on my machine.
    Any help is very appreciated
    Martin

    I don't get any.
    It just crashes. There's neither an exception thrown nor any other error msg.

Maybe you are looking for

  • Web photo album error - need help please

    I am using the newer version, which is Web Phot Album 2.1. It used to work fine, i installed the new update for dreamweaver and now it doesn't work. When i did update dreamweaver, I did what it said and disabled the exentions. So, to the problem. Whe

  • Crystal Reports: report created on a system can't run on another

    Having a problem with fully qualified table names.  I have a report that was developed offsite.  In the 'show sql query' none of the tables are fully qualified (prefixed with the database name).  I added a new table and the table is shown as prefixed

  • Email and calendar integration?

    Can anyone offer solutions on integrating email and calendar functionality? I'm looking for something similar to what you would find on hotmail, yahoo, etc. Feel free to email or call me at 716-224-7839. Thanks. Harry

  • Delivery date in scheduling agreement

    If delivery date in scheduling aggrement is 20th  and vendor has supplied the material on 15 th iteslf then are we able to do grn on 15th or Not. Or we should wait for the date 20th. Thanks, Kiran

  • A video camera that looks as good as the EOS 5DIII & the new 70D

    Hi everyone.  I really want to make myself clear on my questions, so I'm going to preface them with a short wall of text.  My apologies.   I work for local government and we film political meetings, PSA's, informational videos, documentaries, and loc