Postgres Database connection Insert only.

I want to be able to have a user fill out a registration form and upon submission by email have the data inserted into a postgres database. Can anyone give me an example as to when the connection is made do I do a "Select *" statement and then upon the click event of the submit button a "insert statement"? Just a simple example will help. I have looked at formbuilder but still can't get it to work with an insert only.
Thanks,
Bill

I did that and got this response:
724 Sun Apr 10 05:46:14 CDT 2005 org/postgresql/Driver$1.class
12077 Sun Apr 10 05:46:14 CDT 2005 org/postgresql/Driver.class
1610 Sun Apr 10 05:46:16 CDT 2005 org/postgresql/util/PSQLDriverVersion.class
Here's my entire code:
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperPrintManager;
import net.sf.jasperreports.engine.JasperRunManager;
import net.sf.jasperreports.engine.export.JRCsvExporter;
import net.sf.jasperreports.engine.export.JRXlsExporter;
import net.sf.jasperreports.engine.export.JRXlsExporterParameter;
import net.sf.jasperreports.engine.util.JRLoader;
class run{
public static void main(String[] args){
Map parameters = new HashMap();
parameters.put("ReportTitle", "testing");
parameters.put("MaxOrderID", new Integer(10500));
String fileName = "myfile";
Connection my_con = getConnection(); }
private static Connection getConnection() throws ClassNotFoundException, SQLException
String driver = "org.postgresql.Driver";
String connectString = "jdbc:postgresql://test.vltool.com:5432/vlis";
String user = "username";
String password = "password";
Class.forName(driver);
Connection conn = DriverManager.getConnection(connectString, user, password);
return conn;
I commented out all the unneccesary stuff once, and it still didn't work!

Similar Messages

  • Cluster Database Connect Works Only in stand-alone OEM

    When I connect to OEM standalone, I can connect to the cluster database with no problem. When I try to connect with the management server, it gives me the ORA-12514 error. The service name works both in SQLplus and in stand-alone mode.
    My console is running on a windows XP machine, the management server and OEM catalog are on a machine running 9.2, the cluster resides on two other machines running 9.2.
    What do I need to change to get OEM to let me open the cluster database using the management server?

    Try to create a service like this one and try:
    joel.us.acme.com=
    (description=
    (load_balance=on)
    (failover=on)
    (address=(protocol=tcp)(host=host1)(port=1521))
    (address=(protocol=tcp)(host=host2)(port=1521))
    (address=(protocol=tcp)(host=host3)(port=1521))
    (connect_data=
    (service_name=joel.us.acme.com)))
    for more information about it you can check these
    documents:
    Real Application Clusters Administration Contents / Search / Index / PDF
    Real Application Clusters Concepts Contents / Search / Index / PDF
    Real Application Clusters Deployment and Performance Contents / Search / Index / PDF
    Real Application Clusters Documentation Online Roadmap Contents / Search / /
    Real Application Clusters Real Application Clusters Guard I - Concepts and Administration Contents / Search / Index / PDF
    Real Application Clusters Real Applications Clusters Guard I Configuration Guide Release 2 (9.2.0.1.0) for UNIX Systems: AIX-Based Systems, Compaq Tru64 UNIX, HP 9000 Series HP-UX, and Sun Solaris Contents / Search / Index / PDF
    Real Application Clusters Setup and Configuration Contents / Search / Index / PDF
    http://otn.oracle.com/pls/db92/db92.docindex?remark=homepage
    Joel Pérez

  • Database connection(select ,insert query) within javascript function

    Hi ,
    How to write the database connection(insert,delete or select query) within javascript function.Is it possible.Anyone can you help me
    than you

    Hi ,
    How to write the database connection(insert,delete
    ete or select query) within javascript function.Is it
    possible.No

  • Please Help in Connecting to a Postgres database

    Hi,
    I installed the ODI 10.1.3.5 in my PC, I'm using a Windows Server 2003 R2 Standard Edition, I puzzled of how to connect to a Postgres Database. I downloaded a postgresql-8.1-413.jdbc3.jar driver and placed it in the \OraHome_1\oracledi\drivers. Then what will I do next?
    Thanks,
    Randy

    Hi CTS,
    That was helpful, But I already added Postgres in Topology.
    My problem now is how to create a Master Repository in Postgres?
    Here are my settings;
    Driver : org.postgresql.Driver
    URL : jdbc:postgresql://localhost:5432/mydatabase
    User : username
    Password : password
    I select PostgreSQL in the Technology, badluck I receives this error message.
    Error Detected during Repository Installation com.sunopsis.tools.core.exception.SnpsRuntimeException: com.sunopsis.tools.core.exception.SnpsRuntimeException: Unable to find the XML file corresponding to your technology.
    Please someone help me on this.
    Thanks,
    Randy

  • How create a database connection only one for lot of AM

    Hi ,
    In My Application am having lot of Application module its containing database connection per AM its connecting to same database only if i want to make it unique connction how i can proceed. which is correct way any one can help me
    Thanks
    Prabeethsoy

    The source trace show how the JUApplication was created and saved to BindingContext.
    1. private static void invokeBeginRequest(
    BindingContext bindingCtx, HashMap requestCtx)
    Object obj;
    Iterator iter = bindingCtx.valuesIterator();
    while (iter.hasNext())
    obj = iter.next();
    if (obj instanceof DCDataControlManagement)
    2.First type is DCDataControlReference ====> ((DCDataControlManagement)obj).beginRequest(requestCtx);
    3. ADFBindingFilter chain.doFilter(request, response);
    4. DCDataControl control = actionBinding.getDataControl();
    5. JUCtrlActionBinding
    public final DCDataControl getDataControl()
    if (mDataControl == null)
    if (getDef() instanceof JUCtrlActionDef )
    String name = ((JUCtrlActionDef)getDef()).getDataControlName();
    if (name != null && getBindingContainer() != null)
    BindingContext ctx = getBindingContainer().getBindingContext();
    if (ctx != null)
    6. ========>mDataControl = ctx.findDataControl(name);
    if (mDataControl == null)
    if (getIteratorBinding() != null)
    mDataControl = getIteratorBinding().getDataControl();
    else if (getBindingContainer() != null)
    mDataControl = getBindingContainer().getDataControl();
    return mDataControl;
    7. BindingContext
    public DCDataControl findDataControl(String name)
    return (DCDataControl)get(name);
    public Object get(Object key)
    Object rtn = mDCMap.get(key);
    if (rtn == null)
    rtn = mBCMap.get(key);
    else
    if (rtn instanceof DCDataControlReference)
    // remove the reference in order to prevent re-entrancy.
    remove(key);
    *8. Create JUApplicaion======> rtn = ((DCDataControlReference)rtn).getDataControl(this);*
    *9. save JUApplication with AM ======>  put(key, rtn);*
    return rtn;
    10. DCDataControlReference
    public DCDataControl getDataControl(BindingContext ctx)
    String name = getName();
    DataControlFactory factory;
    try
    Class factoryClass = JBOClass.forName(mDef.getFactoryClass());
    factory = (DataControlFactory)factoryClass.newInstance();
    catch(Exception e)
    throw new JboException(e);
    // JRS this is a backwards compatibility step. The generic
    // DataControlFactoryImpl used to perform this mapping such
    // that the bean class will be faulted back the definition class
    // if null. I am performing this mapping at RT only in order
    // to maintain the DT integrity (i.e. I don't want the DT to start
    // faulting the bean class as the definition class when writing the
    // DC def).
    if (mDef.getBeanClass() == null)
    mDef.setBeanClass(mDef.getDefinitionClass());
    *11. create JUApplicaion =====> DCDataControl dc = (DCDataControl)factory.createSession(*
    ctx, mDef.getName(), mUserParams, mDef);
    SessionContext sessionCtx = ctx.getSessionContext();
    if (sessionCtx != null)
    dc.setSessionContext(sessionCtx);
    // fire the deferred beginRequest notication on the new datacontrol
    if (mRequestContext != null)
    12.======>dc.beginRequest(mRequestContext);
    mRequestContext = null;
    return dc;
    }

  • Parameter insert database connectivity

    I'm currently having a little trouble getting this to work.  Below is a picture of my block diagram, it includes pretty much everything there is to know about my error. As you can see it says it has a syntax error. I'm fairly new to labVIEW but I do quite a bit of database programming. The insert statments looks correct. I would assume the error lies within the values passed into the parameters. I've tried it both with and without single quotes around the values. I would also like to note that the 2 int32 convertsion were thrown in after the error was already there. Was just running out of ideas to try. Incase you can't recognize the VI. We have an open database vi -> parameterized query -> 2 set parameters -> exec query-> free object-> free conn-> close conn. This is the exact same layout for the database connections as is in the database connectivity manual. I've already tested the connection to the database inserting a single value and that worked. For some reason now that I'm spliting the values coming out of the DAQ assistant and made it a parameterized query, it is no longer working. Any help would be great. Thanks.

    [As far as the special characters in the insert
    string I wouldn't believe there would be any unless they some how get
    added automatically. If they are is that a common issue? ]
    I was just making sure human error didn't creep in when the INSERT string was created. It's bit me more than once.
    Have you tried hard coding some Voltage and Current values into the Set Parameter Value VI's? You might also try setting the "auto-detect parameters" in the Create Parameterized Query VI to TRUE and disconnecting the Parameters array constant. Also, check the string "Current" in the Parameter constant array (index 1), make sure there's no space at the end of the name.
    “A child of five could understand this. Send someone to fetch a child of five.”
    ― Groucho Marx

  • Why do I get a class conflict between the Prepare SQL.vi and the Get Column Name.vi with the SQL Toolkit compatibility vis from the Database Connectivity Toolkit?

    I have done extensive programming with the SQL Toolkit with LabVIEW versions through 6.1. My customer now wants to upgrade to Windows 7, so I am trying to upgrade to LabVIEW 2009 (my latest purchased version) using the Database Connectivity Toolkit, and the SQL Toolkit Compatibility vis. Everything seemed to be going okay with the higher level SQL operations, but I ran into trouble with the Get Column Name.vi. 
    The pictures below show the problem. The original SQL Toolkit connected the Prepare SQL.vi with the Get Column Name.vi with a cluster of two references, one for connection, and one for sql. The new compatibility vis have a class conflict in the wire because the Prepare SQL.vi contains a cluster with connection, and command references, but the Get Column Name.vi expects a cluster with connection and recordset references. 
    How do I resolve this conflict?
    Thank You.
    Dan

    I've never worked with the old version of the toolkit, so I don't know how it did things, but looking inside the SQL prep VI, it only generates a command, and the the column name VI wants a recordset. I'm not super familiar with all the internals of ADO, but my understanding is that is standard - you only have the columns after you execute the command and get the recordset back. What you can apparently do here is insert the Execute Prepared SQL VI in the middle and that will return what you need.
    I'm not sure why it worked before. Maybe the execute was hidden inside the prep VI or maybe you can get the column names out of the command object before execution. In general, I would recommend considering switching to the newer VIs.
    Try to take over the world!

  • When using the Database Connectivity Toolset, reads and writes with long binary fields are incompatible.

    I am trying to write LabVIEW Variants to long binary fields in a .mdb file using the Database Connectivity Toolset. I get errors when trying to convert the field back to a variant after reading it back from the database.
    I next tried flattening the variant before writing it and ultimately wound up doing the following experiments:
    1) If I use DB Tools Insert Data to write an ordinary string and read it back using a DB Tools Select Data, the string is converted from ASCII to Unicode.
    2) If I use DB Tools Create Parameterized Query to do an INSERT INTO or an UPDATE operation, specifying that the data is BINARY, then read it back using a DB Tools Select Data,
    the length of the string is prepended to the string itself as a big-endian four-byte integer.
    I can't think of any way to do a parameterized read, although the mechanism exists to return data via parameters.
    Presuming that this same problem affects Variants when they are written to the database and read back, I could see why I get an error. At least with flattened strings I have the option of discarding the length bytes from the beginning of the string.
    Am I missing something here?

    David,
    You've missed the point. When a data item is flattened to a string, the first four bytes of the string are expected to be the total length of the string in big-endian binary format. What is happening here is that preceding this four-byte length code is another copy of the same four bytes. If an ordinary string, "abcdefg" is used in place of the flattened data item, it will come back as <00><00><00><07>abcdefg. Here I've used to represent a byte in hexadecimal notation. This problem has nothing to do with flattening and unflattening data items. It has only to do with the data channel consisting of writing to and reading from the database.
    I am attaching three files that you can use to demonstrate the problem. The VI file c
    ontains an explanation of the problem and instructions for installing and operating the demonstration.
    Ron Martin
    Attachments:
    TestLongBinaryFields.vi ‏132 KB
    Sample.UDL ‏1 KB
    Sample.mdb ‏120 KB

  • JCAP512 and JCAP6 conflict with concurrent database connectivity

    So here is the situation:
    Environment:
    - We have a production JCAP6 appserver (AIX server 1) running a project pulling data from database A
    - We have 4 JCAP512 domains on AIX Servers 2,3,4 running 4 distinct projects pulling data from server A
    - All project run on a schedule of 5 minutes and login to the server with the same login
    - Database A is SQL Server
    - repository based code
    Scenario:
    - All 5 above processes run concurrently in the greater JCAPS environment.
    - When all 5 processes are running, the JCAP6 process runs fine with no issue but at the same time the 4 JCAP512 processes hang on the database side waiting for a resultset with a wait status of ASYNC_NETWORK_IO
    - As soon as the JCAP6 process completes, all 4 JCAP512 processes start running with no errors. Once the JCAP6 process starts again, same result.
    - We shut off the JCAP6 process and all 4 JCAP512 processes run with no issue
    So after my high-school proof setup above my question comes to what is going on??? All of these processes run on their own isolated physical and application servers. Their only commonaliy is the login to the database. Are there any known database connectivity settings that would limit user transactions if another (same) user connection currently exists?
    Has anybody seen anything like this? Ay assistance would be greatly appreciated.
    Bryan
    Edited by: bgrant88 on Jan 29, 2010 2:15 PM

    I've never worked with the old version of the toolkit, so I don't know how it did things, but looking inside the SQL prep VI, it only generates a command, and the the column name VI wants a recordset. I'm not super familiar with all the internals of ADO, but my understanding is that is standard - you only have the columns after you execute the command and get the recordset back. What you can apparently do here is insert the Execute Prepared SQL VI in the middle and that will return what you need.
    I'm not sure why it worked before. Maybe the execute was hidden inside the prep VI or maybe you can get the column names out of the command object before execution. In general, I would recommend considering switching to the newer VIs.
    Try to take over the world!

  • Database Adapter-Insert

    Hi,
    I am new to BPEL. I am trying to learn through tutorials. I am working on Insert tutorial (Database Adapters).
    I was able to compile the project sucessfully in jdev and deploy to Bpel server.
    After giving the input and hitting on post xml message the follwing error comes up:
    file:/C:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_Insert_1.0_3955c8686706b0e75f228f767a18cf38.tmp/InsertService.wsdl [ InsertService_ptt::insert(MoviesCollection) ] - WSIF JCA Execute of operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [Insert.Movies]. [Caused by: JDBC 2.0 feature is not yet implemented]
    ; nested exception is:
         ORABPEL-11616
    DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [Insert.Movies]. [Caused by: JDBC 2.0 feature is not yet implemented]
    Caused by Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: JDBC 2.0 feature is not yet implementedError Code: 0.
    Does anyone have idea about this error?
    My settings in oc4j_ra.xml are as below:
    <connector-factory location="eis/DB/BPELSamples" connector-name="Database Adapter">
              <config-property name="xADataSourceName" value=""/>
              <config-property name="dataSourceName" value=""/>
              <config-property name="platformClassName" value="oracle.toplink.internal.databaseaccess.OraclePlatform"/>
              <config-property name="usesNativeSequencing" value="true"/>
              <config-property name="sequencePreallocationSize" value="50"/>
              <config-property name="defaultNChar" value="false"/>
              <config-property name="usesBatchWriting" value="true"/>
              <config-property name="driverClassName" value="oracle.lite.poljdbc.POLJDBCDriver"/>
              <config-property name="connectionString" value="jdbc:polite4@localhost:1531:orabpel"/>
              <config-property name="userName" value="system"/>
              <config-property name="password" value="manager"/>
              <config-property name="minConnections" value="1"/>
              <config-property name="maxConnections" value="5"/>
              <config-property name="minReadConnections" value="1"/>
              <config-property name="maxReadConnections" value="5"/>
              <config-property name="usesExternalConnectionPooling" value="false"/>
              <config-property name="usesExternalTransactionController" value="false"/>
              <connection-pooling use="none">
              </connection-pooling>
              <security-config use="none">
              </security-config>
         </connector-factory>
    and datasources.xml is
    <connection-pool name="BPELPM_CONNECTION_POOL">
    <connection-factory factory-class="oracle.lite.poljdbc.POLJDBCDriver"
    user="system"
    password="manager"
    url="jdbc:polite4@localhost:1531:orabpel" />
    </connection-pool>
    <managed-data-source name="BPELServerDataSource"
    connection-pool-name="BPELPM_CONNECTION_POOL"
    jndi-name="jdbc/BPELServerDataSource" tx-level="global"/>
    <managed-data-source name="BPELServerDataSourceWorkflow"
    connection-pool-name="BPELPM_CONNECTION_POOL"
    jndi-name="jdbc/BPELServerDataSourceWorkflow" tx-level="local"/>
    <!--managed-data-source name="BPELSamplesDataSource"
    connection-pool-name="BPELPM_CONNECTION_POOL"
    jndi-name="jdbc/BPELSamplesDataSource" tx-level="global" /-->
    I have a database connection called bpel samples in jdev. Can anyone help me in creating bpel process to insert data in a table using database adapters.
    I am not able to get any output for any of the database adapter tutorials. Any hints????
    Thanks in advance.
    Edited by: user3833651 on Apr 22, 2009 8:17 PM

    The database version is only important with the dehydration store. If you are using the adapters to select / delete / update / insert data into your application it comes down to the jdbc drivers. Basically if you are above 8i you should be fine.
    olite is a very basic database, and the jdbc drivers are flaky, it's also not based on the Oracle code, therefore is not upgradable if you want to increase performance. You would need to perform some manual steps to migrate to a standard database.
    If you are wanting to do basic tutorials and don't want to have a heavy database using all your resources, use oracle XE. No need to pact. If you have a oracle database installed somewhere use that.
    http://www.oracle.com/technology/software/products/database/xe/index.html
    cheers
    James

  • BO XI3.1: Support for Greenplum/PostGres Database

    Is Support for GreenPlum /Postgres database schedule for next service pack of BO XI3.1?
    With Postgres database - we have support only in Crystal and not in BO according to supported platform guide.
    Could you please advise whether we have scheduled the support for GreenPlum/Postgres database for BOXI 3.1 - in the next release of BOXI 3.1 SP2 ?
    Information from customer :
    - for Postgres database with ODBC drivers are working ok.
    - whether GreenPlum database is going to be supported in the next service pack
    - whether Postgres JDBC drivers could be used to Connect to GreenPlum Database instead of Postgres ODBC Drivers.
    Could you please advise on this database support as requested by customer ?
    Regards,
    Ganesh

    Hi, I've experienced using Greenplum database and odbc PostsgreSQl
    For BOE 3.1, you can create Webi, but not applicable with dashboard part. Where it cannot recognized the Postgre driver.
    Currently i'm trying to use another driver from DataDirect.
    Thats all for now.

  • Database Connection Pattern

    Hi:
    I'm looking for a best practice to centralizing access to the database. All the examples that I have seen on the Sun site and the Internet look a little clumsy. What I'm trying to ask is this. Instead of CODING a connection object, Statment object etc. like the examples provide - every time I make a query. Is there a better way of centralizing make making this code generic.
    For example:
    I have an object that describes my records say ModelBunny
    mBunny.setEars
    mBunny.setTail
    mBunny.setColor
    I have an object that describes all my database queries that I want to execute say DataBunny
    dBunny.getBunnyByID
    dBunny.getAllBunnies
    dBunny.getBunnyByColor
    I created a transaction object that allows me to load up multiple sql commands into the transaction object for more complex calls.
    I pass the transaction object into a generic connection object that opens, runs the transaction and then closes. For inserts, updates and deletes this pattern works great - I pass back an array of int and let the user know what happened - success/failure.
    Here is the root of the issue:
    in my generic connection object - I create a query method. Where I pass in a single query statement that returns a - resultset (yes here is my problem).
    The resultset is only valid if the connection remains open - then as soon as I close out the connection in my "finally" - I'm done, toast, otherwise - screwed.
    I thought of making a method where I can manually close my connection from the calling object - but I want something more brainless where another developer using this framework won't forget and leave the connection dangling.
    Is there some way I can process the resultset generically into an arraylist and then pass back the arraylist?
    I'm not even certain that this pattern that I'm using is wise. Everybody seems keen on writing the same boiler plate code every time they want to execute a command. I don't think this is good design practice and make the code unmanageable. I'd like some advice or a pointer to something better.
    I'm using OracleXE for my test bed. I'd like to leave everything as generic as possible because our platform will likely shift to another DBMS.
    Thanks for your help.

    FYI: Here is the meat of the generic class that I'm talking about.
    public class DbConnection {
    private String _urlDbCnn       = "";   // the JDBC url to the database
    private String _username       = "";   // a valid username to access the database
    private String _password       = "";   // a valid password to access the database
    private String _dbDriver       = "";   // a valid JDBC driver
    private Connection _cnn            = null; // this will be the active connection
    private String _sqlStatement   = null; // this will be the statement to execute against the database
    public DbConnection(){
    this("oracle.jdbc.OracleDriver",
    "jdbc:oracle:thin:@//192.168.15.200:1521/xe",
    "usernamehere",
    "passwordhere");
    } // constructor - nothing
    public DbConnection(String nwDbDriver, String nwDbURL,
    String nwDbUsername, String nwDbPassword){
    this.setDbDriver(nwDbDriver);
    this.setUrlDbCnn(nwDbURL);
    this.setUsername(nwDbUsername);
    this.setPassword(nwDbPassword);
    } // constructor - DbDriver, DbUrl, DbUser, DbPassword
    private void initializeConnection(){
    // try - get database driver
    try{
    DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
    // try - initialize the database connection
    try{
    this._cnn = DriverManager.getConnection(this._urlDbCnn,
    this._username,
    this._password);
    }catch(SQLException e){
    ErrorTrap trap = new ErrorTrap(ErrorTrapMessage.DataConnectionNotIntitialized, e);
    } // catch - try and initialize the database connection
    }catch(SQLException e){
    ErrorTrap trap = new ErrorTrap(ErrorTrapMessage.DataConnectionDriverFailedToLoad, e);
    } // catch - try and get database driver
    } // method - OpenConnection
    public ResultSet executeQuery(DbTransaction nwTransaction){
    ResultSet results = null; // batch results are returned as an array of integers
    // initialize the database connection
    initializeConnection();
    // try - access the database connection and execute a batch of statements
    try{
    // if - check that the connection is open
    if (this._cnn.isClosed()== false){
    // create a statement object from the connection
    Statement sqlQuery = this._cnn.createStatement();
    // if - check that there is at least one command present
    if (nwTransaction.size() >= 1 ){
    // execute the batch success/error results are returned as an int array
    results = sqlQuery.executeQuery(nwTransaction.get(0).getCommand());
    } // if - check that there is at least one command present
    } // if - check that the connection is open
    catch(SQLException e){
    ErrorTrap trap = new ErrorTrap(ErrorTrapMessage.DataSQLTransactionFailed, e);
    } // catch - SQL Query
    finally{
    // try - close database connection
    try{
    //if - check that the connection is open
    if(this._cnn.isClosed() == false){
    // close the database connection
    this._cnn.close();
    } //if - check that the connection is open
    }catch(SQLException e){
    ErrorTrap trap = new ErrorTrap(ErrorTrapMessage.DataConnectionNotOpen, e);
    } // catch - try and close database connection
    } // finally
    return results;
    } // method - executeQuery
    public int [] executeTransaction(DbTransaction nwTransaction){
    int [] results = null; // batch results are returned as an array of integers
    // initialize the database connection
    initializeConnection();
    // try - access the database connection and execute a batch of statements
    try{
    // if - check that the connection is open
    if (this._cnn.isClosed()== false){
    // create a statement object from the connection
    Statement batchStatement = this._cnn.createStatement();
    // for - loop through each command added to the transaction
    for(DbCommand command:nwTransaction){
    // add the sql command for batch execution
    batchStatement.addBatch(command.getCommand());
    } // for - loop through each command added to the transaction
    // execute the batch success/error results are returned as an int array
    results = batchStatement.executeBatch();
    } // if - check that the connection is open
    catch(SQLException e){
    ErrorTrap trap = new ErrorTrap(ErrorTrapMessage.DataSQLTransactionFailed, e);
    } // catch - SQL Query
    finally{
    // try - close database connection
    try{
    //if - check that the connection is open
    if(this._cnn.isClosed() == false){
    // close the database connection
    this._cnn.close();
    } //if - check that the connection is open
    }catch(SQLException e){
    ErrorTrap trap = new ErrorTrap(ErrorTrapMessage.DataConnectionNotOpen, e);
    } // catch - try and close database connection
    } // finally
    return results;
    } // method - executeCommands

  • What can I actually to with database connections?

    This may sound like an odd question, but once I define a MySQL connection in Dreamweaver, what can I actually do with it? Let me clarify what I'm doing:
    I've only just found out that we can define MySQL connections when a PHP/MySQL site is defined. I'm used to administering my databases via MySequel or phpMyAdmin. Accessing databases in Dreamweaver would rock!
    So now I've got a connection, I can read all my tables... but I can't seem to do anything with them. I can't add data, I can't modify data - all I can do is look at what's already there. I can click the "insert code" or the "view data" option, but they don't seem to do anything useful: The first option only pastes whatever is highlighted in my code, and the second brings up a window displaying the data.
    What am I missing? Can I change the data somehow and just haven't found the option yet? Or what else can I use my database for?
    For example, exporting or importing data, synchronising with another database/database host, etc?

    Database connections are used to develop data driven web sites. So if you are familiar with server side scripting you can write code to make your site dynamic. In the past, DW had server behaviors that streamlined the process of creating web forms and display areas to insert, update and select from database tables, but these have been removed as the code was never quite up to current standards.

  • LabView database connectivity toolkit 1.0.1 compatibility with MS-ACCESS 2010 / Labview report generation toolkit for Office 1.1.3 compatibility with Office 2010

    In the very near future we will be forced to upgrade to Office 2010 Company wide and I am a little concerned with some of our older test platforms that have applications built in LabView 8.2.1.  These applications save data to MS-ACCESS 2000 databases using the LabView database connectivity toolkit 1.0.1.  Office 2003 is also loaded on these test platforms with all test reports generated using the LabView report generation toolkit for Office 1.1.3.
    I have not gotten my hands on a copy of Office 2010 yet to see if there will be any compatibility issues.  Does anyone have any experience in this area?

    The MS-Access part is fairly well isolated through the ADO interface LabVIEW uses. The only possible problems there IMHO are difficulties with possible Acess compatibilities itself such as an example, SQL statement you may have invoked directly through the ADO interface. Maybe you did use a depreciated command back then that has since been removed. As long as the only thing you do are simple INSERT and SELECT statements only, I would expect it to just keep working.
    The Report Generation interface is a different beast. Microsoft manages to change the Automation interface with every version of office in a way that strongly binding applications like LabVIEW break on. There is no good way around that except not changing those methods, but that is a cause that has been lost already. You will certainly have to verify the version dependant Report Generation API VIs to still work with Office 2010 and most likely you will have to make some changes to those VIs to make them work again with the modified ActiveX interface of Office 2010. Note, that I have no experience with porting report generation to Office 2010 but I have had some headaches from porting that between Office 97, 2000, 2003, and 2007.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Can anybody give me the jdbc code for postgres database.

    Hello all,
    I tried to search for sample jdbc code for postgres. But I couldn't find working sample. Can anybody please post the sample jdbc code for connecting to postgres database.
    I have already added the jar file, "postgresql-8.0-312.jdbc3.jar" to the build path.
    Thanks.
    Srinivas

    Hi,
    Thanks for your reply!
    I wrote the following code, but the insert doesn't add a row.
    try {
              Class.forName("org.postgresql.Driver");
              //Preparing Conenction String     
              Connection con = DriverManager.getConnection("jdbc:postgresql://<name>:5432/sales_office_test", "sales_office_data","sales_office_data");
              PreparedStatement prepSt =  con.prepareStatement(
                                  "INSERT INTO office_personnel (office_id, salutation, firstname, lastname, email_address,"
                                  + " cellphone, phonenumber, extension, password, username) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
                             prepSt.setString(1, newOfficeIds);
                             prepSt.setString(2, whopperUserSalutation);
                             //Close statement
                             prepSt.close();
         } catch (ClassNotFoundException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
         } catch (SQLException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
         }If I print the connection object I get
    Sql connection value: org.postgresql.jdbc3.Jdbc3Connection@10965c3 I double checked the same query by directly executing it on the web interface to the postgres, works fine there and creates the row...
    What could be wrong.
    Thanks
    Srinivas

Maybe you are looking for

  • 0D/0A pair written into data file when it shouldn't be

    Hello, I have a data file problem. My customers data is written as a 398 byte row in a .csv file. It's OK that the row ends with a CR/LF. But the data is actually modified by the string to array or the write to spreadsheet function. In the example be

  • How to create the plastic look in an image

    Hi there, I have seen so many times images that seem to look like plastic or they look as if the item is real. it is because it has a shadow behind it and the surface seems to look slightly curved giving it that 2d 3d effect. I understand how to do t

  • Firefox PDF links - Trying to Open in Pages

    Hi all, I have a bit of a hiccup in that every time I attempt to click on a PDF link in Firefox 3.6.3 to open the file in Preview, the system attempts to open it with pages and I receive the following error message: The document "PhotoVideo_Solicitat

  • HT4489 Import csv file

    I need to import a csv file into my icloud contacts.  I went to help and it instructs me to "choose File > Import".  However, I cannot find "File" to choose it.  Where is it?

  • Please help! not serializableException: im not sure why!

    hello all, im using a JTable and would like to save the information in the table. whe the user presses the save button, i would like to call my save methods, but i end up with a serializable exception on my filfilter. I am not sue why this occurs, so