Question about a database saving

Hey all. First off, I just started playing with databases yesterday, so forgive my question if it seems obvious/stupid.
I finally got JDBC working with HSQLDB (I wanted something portable), and wrote some code to connect to the database, create a table, and input/retrieve data from the table. The only way I could get the database to retain the stuff I wrote if I opened it the next time was to use statement.execute("SHUTDOWN"). Now this is fine, but is there any way to have the database save all the info besides using the shutdown command?
When I didn't use the shutdown command, the next time I connected to the database and tried to read values from the table I made before, I got an error. When I did use the shutdown command, it printed them right out for me, so I'm assuming that IS my problem (It very well may not be).
Anyway, I had a hard time explaining, so if any further explaination is needed please let me know. And thank you in advance!
Edit: If sample code would be nice, just say so and I will post a couple examples of the issue.

Alright. I looked through both. The commit thing will come in very handy, but I think I described the problem in slightly the wrong way. It is my understanding that autoCommit is set to a default of true. So I will set it to false and try to make my program employ ACID (Which might be kind of hard, I'm new at this). But I believe my testing program had a slightly different problem. Since there's not much of a way to distribute my current database, I'll try to describe the problem instead of posting the code.
I have a databse with a table created. It can hold an employee name as well as their ID number (Not for my real program, I was following a tutorial). I had one simple add statement, that added an employee name and an ID. If I run the program with
st.execute("SHUTDOWN");at the end, every time I run the program I will get an additional copy of that data every time I run it. Without the shutdown, I can run the program 100 times and still only have as many entries as I had before.
That's kind of what I meant by the database not saving. It may be commiting it, but if I close without the shutdown command, it doesnt seem to change the database.
Am I coding something incorrectly, or is this intended behavior? The question may seem slightly weird and useless, but what if someone alt-f4ed out of a program? I don't see how the shutdown command could be issued then. Again, sorry if my question is hard to understand, describing database problems isn't easy for me.

Similar Messages

  • Question about import database pk, fk

    Hi
    I want to ask a question about imported database. I imported database and I noticed tables doesnt have Primary key or foreign key. They havent relation between eachs. Why can this occured ?
    is it about import or another something?

    yeah ı am surprised none of tables have pk or fk ..
    but ı want to show you http://i51.tinypic.com/2hedc9d.jpg
    what is blue shapes in there ?
    can be foerign keys ?

  • Few questions about upgrading database

    Hi everyone,
    greetings of the day
    I have few questions about the upgrading database,
    In export and import mode
    1.can we have new name for the target database,
    2.I think we need to create tablespaces ,do we need to create users as well
    3.If we are upgrading from 9i to 10g database ,any activity to be perfromed other than creating a new sysaux tablespace
    4.How come we get consistent export
    In DBUA mode ( in the same machine only)
    1.Do we need shutdown / startup restrict the database
    2.How can we move the files to the new location
    3.Can we change db_name of the database
    4.Can we use the old database as well
    In manual upgration using catupgrd scripts
    1.Can we rename the db_name
    2.can we use old database as well
    3.how to move the database files to the new location
    4.can we perform this kind of upgrade on a different server
    5.when we startup upgrade in the new home ,how it identifies the old database in-order to upgrade the old one
    Thanks

    udayjampani wrote:
    Hi everyone,
    greetings of the day
    Pl post details of source and target database versions, along with your OS details.
    I have few questions about the upgrading database,
    In export and import mode
    1.can we have new name for the target database,Yes.
    2.I think we need to create tablespaces ,do we need to create users as wellYou can create users, but it is not necessary. You need to pre-create tablespaces only if their characteristics/locations on the target are different than on the source.
    3.If we are upgrading from 9i to 10g database ,any activity to be perfromed other than thisNot that I am aware of - see the steps in the Upgrade Guide - http://docs.oracle.com/cd/B19306_01/server.102/b14238/expimp.htm
    4.How come we get consistent export wetherEnsure the database is started in restricted mode, so users will not be able to access the database during the export.
    >
    In DBUA mode ( in the same machine only)
    1.Do we need shutdown / startup restrict the databaseNo - DBUA will do this automatically for you.
    2.How can we move the files to the new locationYou can after the upgrade move the datafiles to wherever you want - use the ALTER DATABASE RENAME DATAFILE (http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_1004.htm#i2082829) command.
    3.Can we change db_name of the databaseI do not believe this is possible with DBUA.
    4.Can we use the old database as wellNo - the database will be upgraded by DBUA - there is no "old" database.
    >
    >
    In manual upgration using catupgrd scripts
    1.Can we rename the db_nameYes.
    2.can we use old database as wellNo - the scripts will upgrade the database - there is no "old" database.
    3.how to move the database files to the new locationSee above.
    4.can we perform this kind of upgrade on a different serverPl elaborate on what you mean by this. You can copy the existing database to a different server (assuming compatible OS) and upgrade it there.
    >
    >
    ThanksHTH
    Srini

  • A Question about LV Database Connectivi​ty Toolkit

    Hello everyone!
    I have a question about using LabVIEW DataBase Connectivity Toolkit 1.0.2 that eagerly needs your help. I don't know how to programmaticlly create a new Microsoft Access(.mdb)file (Not a new table in a existing Database)using LabVIEW Database Connectivity Toolkit1.0.2. As you know, usually we can set up the connection by creating a Universal Data Link (.udl) file and inputting the path to the DB Tools Open Connec VI in the LabVIEW DataBase Connectivity Toolkit. However, searching a table within an existing database containing a great many tables is a toilfulif job. If I want to use a new DataBase file with the date and time string as its name to log my acquisition data in each measurement process, how to do? I am sure someone of you must can resolve my question, and thanks very much for your help.

    I don't know what your real design considerations are here but, from I understand from your post, this is a really bad way to go about the process of logging data -- IF you want to be able to do significant ad hoc or stored procedures analyses after it has been collected.  Using separate MDB files for data that ONLY differs by one field (namely that date) is not the most efficient way to organize it.  What would be much more efficient would a joined table including the date and a reference ID of some sort for the various measurements that were done.  That way your stored procedures for looking at ALL measurements of type X would be very simple going across ALL dates.  Making such a comparison across multiple MDB files is a much more challenging process AND doing the original data collection in that way doesn't really gain you anything.
    Generally, if something is difficult to do in the DCT (Database Connectivity Toolkit) it's because it's a "not good thing" to do within MDBs.  I know that others probably disagree with that but I've worked with Access since it's initial release and other RDBMs prior to that both through compiled tools, Unix scripts, etc.  You may, of course, still choose to proceed in the way you've described and that may work excellently for you. 

  • Basic question about Flashback Database

    Hi,
    I have a very generic question about using Flashback Database.
    On my testing systems, for performance testing and simulation purposes, I want to create a guaranteed restore point so I can test impact on batch when code change releases are done, before deployment in production.  My confusion is with respect to redo logs, as summarized in the questions below:
    1. Is it possible to change redo log files, when a guaranteed restore point has been configured?
    2. If yes, will the Flashback to restore point, also change the size of the redo logs?
    I could not find anything in the docs about this....hence my question....
    Appreciate your time taken in responding to these questions....
    Regards.

    HI,
    donneskold wrote:
    Hi,
    I have a very generic question about using Flashback Database.
    On my testing systems, for performance testing and simulation purposes, I want to create a guaranteed restore point so I can test impact on batch when code change releases are done, before deployment in production.  My confusion is with respect to redo logs, as summarized in the questions below:
    1. Is it possible to change redo log files, when a guaranteed restore point has been configured?
    1) Yes it is possible.
    2. If yes, will the Flashback to restore point, also change the size of the redo logs?
    2) It will not change the size of redo log file.  Cannot resize a redo log file..
    I could not find anything in the docs about this....hence my question....
    Appreciate your time taken in responding to these questions....
    Regards.
    Thank you

  • Fundamental Question about Lightroom and saving images

    I have to laugh as I get ready to pose this question because I've been working with the program for two weeks with Scott Kelby's book and with Lynda.com, and I'm still profoundly confused about what is happening to the photo. To wit: I open a camera raw file in lightroom and start playing with it, even taking snapshots at various stages along the way. If I don't export the photo to Photoshop and save it there, what becomes of these changes? Do they stay with the photo always? Do they disappear when I shut down the program? There's no SAVE button with Lightroom which just plain flummoxes me! Can anyone 'splain this to me, please? Thanks.

    To clarify. Nothing happens to your originals. Lightroom stores the edits in a database (and if you wish alongside the original in a xmp sidecar file) as a set of instructions that the program uses to recreate the end product by following the instructions. These instructions are changed in the database while you're changing parameter values in Lightroom, so there is no need to save. Also, Lightroom stores a history of changes you did, so you can always go back. Both Lightroom and Adobe's camera raw plugin for photoshop can be used to follow the set if instructions. This way, you always get the highest fidelity image and you can always go back to your development choices without loosing any quality or having to dig up backups. Because of this, you can create multiple virtual copies with different development approaches without having to make a copy of the original and therefore saving you gobs and gobs of disk space. When you need a file for consumption such as a jpeg for a web page, simply export a copy, which burns in your development changes in a developed copy (just like printing a negative would have in the olden days) and trash the copy when you're done with it. You can always recreate it very quickly. This is a radically different approach than you're probably used to.

  • Question about Oracle Database 11g: Program with PL/SQL

    Hello,
    I've read that:
    This course is a combination of Oracle Database 11g: PL/SQL Fundamentals and Oracle Database 11g: Develop PL/SQL Program Units courses.
    In order to preparing for this exam, i should read the student guide, so there are 4 pdf files. One is Oracle Database 11g: PL/SQL Fundamentals, and the other 3 are regarding to Oracle Database 11g: Develop PL/SQL Program Units (volume I, II and III). My question is, regarding to this last one (Oracle Database 11g: Develop PL/SQL Program Units), which volume should i read? I saw that volume I has 400+ pages, and the IIIrd ~80.
    Which document should i read? What's the difference between them?
    Thanks!

    Passing the exam and becoming certified are not a matter of simply reading a book or taking a training class. While books and classroom materials as well as in-class training are all important steps in preparing for an exam, experience and research are just as important. I cannot tell you that there are 53 questions on the exam and every single question maps directly back to page 13, paragraph 3 in XX book. However, If you have the classroom material, and you have the list of exam topics, you should be able to find most of the information you need. In some cases, if you are not completely familiar with a specific topic, or you don't feel like the information in the book gives you all the information you need, you may need to do a little additional research. This is all part of preparing for an exam. This process is what makes you successful as a certified professional.
    Your focus seems to be solely on the course materials that you have and what volumes and chapters you should read. I'm trying to give you a different perspective - preparing for an exam is not necessarily about taking one course or reading one book and being ready. You need to review the exam topics and be sure that you are familiar with each topic.
    Regards,
    Brandye Barrington

  • Question about B1if-Database in SQL-Mgmt-Studio

    Hello,
    We have made some changes in the configuration in SLD.
    We made some more Di-Proxy-Ports and then made Proxygroups for the Databases.
    Nearly every half hour, in SQL-Mgmt Studio we can see this "task" ?
    During the time, this task is online, the Queue-Monitor collects all Jobs... but not more.
    After this Job has finished... B1i begins to work up the jobs.
    Can anyone tell me something about "Rollback Transac" in  B1if-Database ?
    Thanks
    Markus

    Passing the exam and becoming certified are not a matter of simply reading a book or taking a training class. While books and classroom materials as well as in-class training are all important steps in preparing for an exam, experience and research are just as important. I cannot tell you that there are 53 questions on the exam and every single question maps directly back to page 13, paragraph 3 in XX book. However, If you have the classroom material, and you have the list of exam topics, you should be able to find most of the information you need. In some cases, if you are not completely familiar with a specific topic, or you don't feel like the information in the book gives you all the information you need, you may need to do a little additional research. This is all part of preparing for an exam. This process is what makes you successful as a certified professional.
    Your focus seems to be solely on the course materials that you have and what volumes and chapters you should read. I'm trying to give you a different perspective - preparing for an exam is not necessarily about taking one course or reading one book and being ready. You need to review the exam topics and be sure that you are familiar with each topic.
    Regards,
    Brandye Barrington

  • Question about using database links in Forms 10g

    I have a form that uses a database link for the "Query Data Source Name," i.e. it is set to some_view@some_db_link
    For some reason when I run a query using the DB link the query takes approximately 30 seconds. When I remove the link and go local the query takes about one second. Has anybody observed and addressed this issue before (without going local of course)?
    Thanks,
    Thomas

    Let me first say that it is never a good idea to use a db link in the data source. It is better to create a synonym in the database and use this as the data source. If the db link changes, you only have to do this in the database, without recompiling forms.
    create synonym some_view for some_view@some_db_link
    This may already solve your problem. If not, than see if the query is also slow in sqlplus. You may have a problem in your connection between the two databases.

  • Some questions about my database access bean

    The following is a bean (minus imports) that access a database and populates several "articles" and then returns a set of them. pretty plain really.
    The bean is modified from here to add exception cactching and 'fix' other problems along the way.
    http://forum.java.sun.com/thread.jspa?threadID=727979 (thanks evnafets)
    The results list is genericified(!) to avoif unchecked calls (casting) in this line result.add(article);
    public class dataAccess {
        public List getNewsResults() throws NamingException{
            Context initContext = new InitialContext();
            Context envContext = (Context) initContext.lookup("java:/comp/env");
            DataSource ds = (DataSource) envContext.lookup("jdbc/mySite");
            Connection conn = null;
            Statement stmt = null;
            ResultSet rs = null;
            List<newsArticleBean> result = new ArrayList<newsArticleBean>();
            try {
                String sql = "SELECT * FROM news, users WHERE news.user = users.username";
                conn = ds.getConnection();
                stmt = conn.createStatement();
                rs = stmt.executeQuery(sql);
                stmt.execute();
                while (rs.next()) {
                    newsArticleBean article = new newsArticleBean();
                    article.setTitle(rs.getString("title"));
                    article.setAuthor(rs.getString("author"));
                    article.setEmail(rs.getString("email"));
                    article.setNews(rs.getString("news"));
                    article.setPictureURL(rs.getString("pictureURL"));
                    article.setDate(rs.getDate("date"));
                    article.setTime(rs.getTime("time"));
                    result.add(article);
            } catch (SQLException e) {
                //error message goes here
            finally {
                try {
                    if (rs != null) rs.close();
                } catch (Exception e) {
                    //error message goes here
                try {
                    if (stmt != null) stmt.close();
                } catch (Exception e) {
                    //error message goes here
                try {
                    if (conn != null) conn.close();
                } catch (Exception e) {
                    //error message goes here
        return result;
    }Some questions that would be of great help if answered:
    Im not too sure what a context does or what im doing with it here. My current understanding is that it allows concurrent access of the database.
            Context initContext = new InitialContext();
            Context envContext = (Context) initContext.lookup("java:/comp/env");
            DataSource ds = (DataSource) envContext.lookup("jdbc/mySite");This section im having trouble with too.
    As I see it:
    I set what my sql query will be;
    get a connection @ conn
    now im not too sure what stmt is getting, is it getting ready to send the query.
    stmt does not have an executeQuery() method, so im never actually sure when the sql query gets sent to the database. I have subbed with execute() but it does not take any arguments so the problem of not sending anything remains.
                String sql = "SELECT * FROM news, users WHERE news.user = users.username";
                conn = ds.getConnection();
                stmt = conn.createStatement();
                rs = stmt.executeQuery(sql);Any help greatly appreciated.

    Some questions that would be of great help if
    answered:
    Im not too sure what a context does or what im doing
    with it here. My current understanding is that it
    allows concurrent access of the database.
    Context initContext = new InitialContext();
    Context envContext = (Context)
    Context) initContext.lookup("java:/comp/env");
    DataSource ds = (DataSource)
    aSource) envContext.lookup("jdbc/mySite");
    Nops, it has nothing to do with concurrent access. You use tomcat to set up a Connection Pool. This causes the tomcat server to create a pool of reusable connections on startup. The connection pool (or set of Connection objects) are given a name and the server binds the set of objects to this name in a 'registry'.
    From the code, you use jndi to access the Connections from the pooled objects. While doing so, you have to provide the jndi name against which this object pool is bound to.
    You'll be more clear when you read the fllowing resources.
    http://java.sun.com/products/jndi/
    http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
    >
    This section im having trouble with too.
    As I see it:
    I set what my sql query will be;
    get a connection @ conn
    now im not too sure what stmt is getting, is it
    getting ready to send the query.Yes something of that sort - basically it provides you a wrapper which can accept your query, use the connection object to access the db, execute the query and return a result set.
    stmt does not have an executeQuery() method, so im
    never actually sure when the sql query gets sent to
    the database.er....it has and that's what you use in your code. (http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#executeQuery(java.lang.String))
    I have subbed with execute() but it
    does not take any arguments so the problem of not
    sending anything remains.Hmmm....the execute() method is for a different purpose and it does accept arguments (http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#execute(java.lang.String))
    >
                String sql = "SELECT * FROM news,
    users WHERE news.user = users.username";
    conn = ds.getConnection();
    stmt = conn.createStatement();
    rs = stmt.executeQuery(sql);Any help greatly appreciated.ram.

  • Question about 'Generic Database Connector'

    Hi SAP IdM Gurus,
    I found 'Generic Database Connector' in the list of SAP NW IdM connectors overview.
    I'd like to check the capability of this connector in detail. 
    I'm wondering whether it could provide not only  a connectivity of RDBMS, but also custom-developed application using the RDBSM for their ID/Password repository. If it provides only a connectivity of RDBMS, Is there a connector for the custom-developed application using the RDBSM for their ID/Password repository?
    My question is that which connector is used for the connectivity  of custom-developed application using the RDBSM for their ID/Password repository.
    I would really appreciate it if you could answer the question.
    Thanks
    Kenneth

    Kenneth,
    The Generic Database connector uses a JDBC connection and allows for the and writing to databases.
    That being said, you can also use this connection to set up access to the system or drop access using SQL commands and set them up per the framework.
    What specific Database are you working with?
    Matt

  • Noob question about JWT and saving/loading midlet states

    Hi,
    I am currently playing with a midlet in JWT - it's actually a Java game. I want to "save" particular states of the midlet and then load them. For example, while playing the game, a multiple choice question appears. I want to save the exact progress up until that point in time, choose one of the answers, view the feedback and then load the saved state and try again with another answer.
    I used a lot of game console to PC emulators, and almost all of them support saving and loading states. Does JWT have such a feature? If not, do you know of any Java ME emulator that has it?
    Cheers,
    Tiberiu

    Yes, I am aware. But that does not answer my question.

  • Questions about the database connection

    hi all,
    I am developing a project with JDeveloper 10g and I created a database connection to my Oracle RAC database.
    However, whenever I start the project with the JDeveloper and I do a "netstat -an" with the command prompt window. I show there are over 100 connection ESTABLISHED to my database. I don't have any idea how this happens. The problem is since there are over 100 connection established, I couldn't run the project with the JDeveloper's embedded OC4J.
    Can anyone help me to fix this problem?

    I have set the Max connections to 30 in the connection-pool setting of my project in the Embedded OC4J Server Preferences, but it doesn't work.
    There are still over 100 connections to the database...

  • Question about Access database linking in SharePoint

    I have a database table I created in Access 2010, I can get it into SharePoint as a list and then create a calendar view.  I used the SharePoint icon under Database Tools in Access.  My problem is that when I enter new information in the Access
    Database I am not able to get SharePoint to reflect this update.
    I should state that I am extremely rusty with Access and SharePoint.
    I appreciate any help that can be offered and I thank you in advance.

    Check out few synchronization options from the following link, hope it helps
    https://support.office.com/en-us/article/Synchronize-a-SharePoint-2010-list-with-Access-2010-975bfb97-c799-4fce-b7cc-3db3b397f116
    Cheers,

  • Questions about publishing database articles?

    what is the requirements of publishing my Technical database related article on oracle magazine.
    Please let me know.
    Thank you very much
    azad, Mohammed
    DBA
    La county-DCFS

    http://www.oracle.com/oramag/misc/submit.html

Maybe you are looking for

  • Development with the SDK

    Hello, I am new to SBO SDK development. So I have ran through the tutorial and the samples. I used the profession installer to install some of the samples. After troubleshooting a wizard problem (missing "...setup.msi"), I can successfully create ins

  • How to get my pictures back

    i lost all of my pictures after updating to the lastest software and i backed everything up before updating my software.

  • ADDING CUSTOM FIELDS TO IW38 IN OPERATIONS LIST

    Hi Gurus,,,          I have a requirement where i want to add some custom fields in IW38 Report in the OPERATIONS LIST(NOT BASIC OR FIRST LIST.) I tried Copying the program of IW38 and develop Z program in which i appended some fields in RIHAUFK_LIST

  • Elements Organizer 10 terminates after a few seconds, PC crashes after a few minutes

    A couple of weeks ago, I installed Photoshop+Premiere Elements from the Adobe online store.  Within a couple of days, I noticed that Elements organizer would crash within a minute of starting, sometime withing a few seconds. Also, even when I wasn't

  • I have an old Mac G4 that can only be upgraded to 10.4.11

    I have an old Mac G4 that  can only be upgraded to 10.4.11.  I use Itunes 7 and I  have a Classic Ipod that suddenly says it has been corrupted.  If  I  upgrade the software to 2.3 on the Ipod will i be able to access it from the G4 or  will I then h