Launch mysql script using jdbc api

Hello.
I tried something like this:
               stmt = conn.prepareStatement("source ./etc/schema-ddl.sql");
               stmt.execute();
               stmt.close();but it doesn't seem to work. Is there anyway possible to launch an sql script using jdbc api?
thx in advance

That won't work. Try using Runtime.exec to launch the full MySQL command.

Similar Messages

  • WILL using JDBC API instead of LookUp APIs  hamper performance?????????????

    hi forum experts,
    i have done a JDBC call in a UDF in a message mapping to fetch some records from a database,
    i tried doing it with LookUp APIs,  but i think/found that LookUp APIs dont provide
    any method to execute DML statements, and moreover these APIs dont provide transactional behaviour....
    so i tried with JDBC APIs.......<<<<java.sql.*;>>>>.....where i used custom code to provide transactional behaviour........like explicitly using commit() methods. Where i m using Connection class...and in this case XI communication channels are not being used,,,....
    will using JDBC API instead of LookUp APIs hamper performance????????????

    Hi Sudeep,
    This will surely help u,
    /people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter
    /people/william.li/blog/2007/03/30/using-jdbc-connection-pool-in-xi-message-mapping
    According to help.sap
    Use of Lookup API - Calls to other application systems are sometimes necessary to meet the following requirements:
    &#9679;     To get <b>read </b>access to application system data in the mapping program
    &#9679;     To call existing mapping routines in the application system
    So DML statements couldnt be used
    Additional help
    /people/prasad.illapani/blog/2006/10/25/how-to-check-jdbc-sql-query-syntax-and-verify-the-query-results-inside-a-user-defined-function-of-the-lookup-api
    <i>[Reward if helpful]</i>
    Regards,
    Prateek

  • Inserting a pdf file in mysql database using jdbc

    hi guys,
    i'm developing an application, where i have to upload the documents and store it in the database.
    i'm using mysql db. using the jdbc statements i have stored the contents of the pdf file. But, i'm unable to read the content, it's looks like junk values. and when i retrieved using the stream objects. it looks like the same.
    i'm able to store and retrieve the text based and image files.
    is it possible to store pdf and word documents in the database columns directly??
    any ideas are appreciated.
    thanks in advance,
    -bala

    This may help[
    Table example
    DROP TABLE IF EXISTS `employeephoto`;
    CREATE TABLE `employeephoto` (
    `Employee_ID` varchar(15) NOT NULL default '',
    `Binary_Photo` mediumblob NOT NULL,
    `LastUser` varchar(100) NOT NULL default '',
    `LastMod` datetime NOT NULL default '0000-00-00 00:00:00',
    `Created` datetime NOT NULL default '0000-00-00 00:00:00',
    PRIMARY KEY (`Employee_ID`)
    ) TYPE=MyISAM;
    Save photo as jpeg to database
    public static void saveMySqlPhoto(String empID, ImageIcon icon) {
      try {
        Image image = icon.getImage();
        BufferedImage bImage = new BufferedImage(image.getWidth(null),image.getHeight(null),BufferedImage.TYPE_INT_RGB);
        Graphics bg = bImage.getGraphics();
        bg.drawImage(image,0,0,null);
        bg.dispose();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ImageIO.write(bImage,"jpeg",out);
        byte[] buf = out.toByteArray();
        // setup stream for blob
        ByteArrayInputStream inStream = new ByteArrayInputStream(buf);
        // get or create a connection here
        Connection photoConnection = startup.connectionPool.getConnection();
        sqlStatement = "insert into employeephoto (Employee_ID,Binary_Photo,LastUser,LastMod,Created) values ('"+empID+"', ?, '"+startup.User+"', NOW(), NOW())";
        ps = photoConnection.prepareStatement(sqlStatement);
        ps.setBinaryStream(1,inStream,inStream.available());
        ps.executeUpdate();
        // release or close connection here
        startup.connectionPool.releaseConnection(photoConnection);
      catch (Exception exc) {
        // process error
    }Retrieve photo from database
    public static ImageIcon getMySqlPhoto(String employeeID){
      ImageIcon dPhoto = null;
      // get or create a connection here
      Connection photoConnection = connectionPool.getConnection();
      String sqlStatement = "select Binary_Photo from employeephoto where Employee_ID = '"+employeeID+"'";
      try {
        ResultSet rs = photoConnection.createStatement().executeQuery(sqlStatement);
        if (rs.next()){
          Blob image = rs.getBlob("Binary_Photo");
          // setup the streams
          InputStream input = image.getBinaryStream();
          ByteArrayOutputStream output = new ByteArrayOutputStream();
          // set read buffer size
          byte[] rb = new byte[1024];
          int ch = 0;
          // process blob
          while ((ch=input.read(rb)) != -1){
            output.write(rb, 0, ch);
          byte[] b = output.toByteArray();
          input.close();
          output.close();
          // load final buffer
          dPhoto = new ImageIcon(b);
        rs.close();
      catch (Exception exc) {
        // do error processing
      // release or close connection here
      connectionPool.releaseConnection(photoConnection);
      return dPhoto;
    public byte[] toByteArray(int width, int height, BufferedImage imageBuff) throws java.io.IOException{
      BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
      bi.getGraphics().drawImage(imageBuff, 0, 0, null);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
      JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
      param.setQuality(1.0f, false);
      encoder.setJPEGEncodeParam(param);
      encoder.encode(bi);
      return out.toByteArray();
    }rykk

  • Why jdbc api ?why not use odbc api from java application?

    hi guys....am pretty confused abt these jdbc drivers...am unable to understand why we r using jdbc api when odbc api has been in market prior to jdbc.....please clarify my doubt

    chari wrote:
    hi guys....am pretty confused abt these jdbc drivers...am unable to understand why we r using jdbc api when odbc api has been in market prior to jdbc.....please clarify my doubtbecause jdbc is the way that java does it.
    use it or don't.
    C++ was in the market before java - why was java developed at all? cobol was in the market before C++ - why was C++ developed at all?
    %

  • Launching Shell Scripts

    Would like some pointers on designing a Asynchronous (JMS )component for launching shell scripts.

    Use Runtime and Process calss and make system calls.

  • Serious problem of jdbc-mysql connectivity using tomcat

    hi everybody
    i m in serious problem since last 15-20 days. i m trying hard to make the connection jdbc-mysql using tomcat with the help of a jsp test page but every time i am facing almost the similar probems listed below in detail:
    to make sure that the jdrivers's .jar (mysql-connector-java-3.1.7-bin.jar) available for such connections working fine i have tried the above said connection without using tomcat....which is working fine...for this i have created a dummy database with a dummy table ..and written some queries in the .java file of my code which upon running inserts the specified values in the defined(dummy) database.
    this is the confirmation that the classpath etc..are ok in regard to the mysql-connector-java-3.1.7-bin.jar
    now i have placed a copy of this .jar file in to the commons/lib directory of the tomcat web server(which is suppossed to be the place for such external jars)
    after doing so i have followed 2 methods :
    method 1st:........
    i have made aone more jar file from the following .java file....
    import javax.naming.*;
    import javax.sql.*;
    import java.sql.*;
    public class TestSQLLoad
    String user = "Not Connected";
    String pwd = "no pwd";
    int id = -1;
    public void init() {
    try{
    Context ctx = new InitialContext();
    if(ctx == null ) {
    throw new Exception("Boom - No Context");
    DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
    if (ds != null) {
    Connection conn = ds.getConnection();
    if(conn != null) {
    user = "Got Connection "+conn.toString();
    Statement stmt = conn.createStatement();
    String q = "select name, password, id from user";
    ResultSet rst = stmt.executeQuery(q);
    if(rst.next()) {
    user=rst.getString(1);
    pwd=rst.getString(2);
    id = rst.getInt(3);
    conn.close();
    }catch(Exception e) {
    e.printStackTrace();
    public String getUser() {
    return user;
    public String getPassword() {
    return pwd;
    public int getID()
    return id;
    after compiling it at the cmd prompt i made a .jar file from the .class of it and named it MySQLLoad.jar...then i placed it also in to the commons/lib directory where the mysql-connector-java-3.1.7-bin.jar was already placed.
    then i have changed the server.xml and web.xml files from the conf directory of the tomcat as given here:
    server.xml
    <!-- Example Server Configuration File -->
    <!-- Note that component elements are nested corresponding to their
    parent-child relationships with each other -->
    <!-- A "Server" is a singleton element that represents the entire JVM,
    which may contain one or more "Service" instances. The Server
    listens for a shutdown command on the indicated port.
    Note: A "Server" is not itself a "Container", so you may not
    define subcomponents such as "Valves" or "Loggers" at this level.
    -->
    <Server port="8005" shutdown="SHUTDOWN">
    <!-- Comment these entries out to disable JMX MBeans support used for the
    administration web application -->
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <!-- Editable user database that can also be used by
    UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
    </GlobalNamingResources>
    <!-- A "Service" is a collection of one or more "Connectors" that share
    a single "Container" (and therefore the web applications visible
    within that Container). Normally, that Container is an "Engine",
    but this is not required.
    Note: A "Service" is not itself a "Container", so you may not
    define subcomponents such as "Valves" or "Loggers" at this level.
    -->
    <!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Catalina">
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector
    port="80" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true" />
    <!-- Note : To disable connection timeouts, set connectionTimeout value
    to 0 -->
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
    enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="localhost">
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
    resourceName="UserDatabase"/>
    <Host name="localhost" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
    <Context path="/testdb" docBase="TOMCAT_HOME/webapps/tomcat-docs/testdb"
    debug="5" reloadable="true" crossContext="true" >
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="localhost_DBTest_log." suffix=".txt"
    timestamp="true"/>
    <Resource name="jdbc/TestDB"
    auth="Container"
    type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/TestDB">
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>10</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>5</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>10000</value>
    </parameter>
    <!-- MySQL dB username and password for dB connections -->
    <parameter>
    <name>username</name>
    <value>root</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>mysql</value>
    </parameter>
    <!-- Class name for mm.mysql JDBC driver -->
    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost/testdb?autoReconnect=true</value>
    </parameter>
    </ResourceParams>
    </Context>
    </Host>
    </Engine>
    </Service>
    </Server>
    and the other xml file i.e
    web.xml is here:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <servlet>
    <servlet-name>default</servlet-name>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/TestDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-cl ***>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>invoker</servlet-name>
    <servlet-class>
    org.apache.catalina.servlets.InvokerServlet
    </servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
    <param-name>fork</param-name>
    <param-value>false</param-value>
    </init-param>
    <init-param>
    <param-name>xpoweredBy</param-name>
    <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    <!-- The mapping for the JSP servlet -->
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>abs</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ai</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aif</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aifc</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aiff</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aim</extension>
    <mime-type>application/x-aim</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>art</extension>
    <mime-type>image/x-jg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>asf</extension>
    <mime-type>video/x-ms-asf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>asx</extension>
    <mime-type>video/x-ms-asf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>au</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>avi</extension>
    <mime-type>video/x-msvideo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>avx</extension>
    <mime-type>video/x-rad-screenplay</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bcpio</extension>
    <mime-type>application/x-bcpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bin</extension>
    <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bmp</extension>
    <mime-type>image/bmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>body</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cdf</extension>
    <mime-type>application/x-cdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cer</extension>
    <mime-type>application/x-x509-ca-cert</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>class</extension>
    <mime-type>application/java</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cpio</extension>
    <mime-type>application/x-cpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>csh</extension>
    <mime-type>application/x-csh</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>css</extension>
    <mime-type>text/css</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dib</extension>
    <mime-type>image/bmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>doc</extension>
    <mime-type>application/msword</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dtd</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dv</extension>
    <mime-type>video/x-dv</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dvi</extension>
    <mime-type>application/x-dvi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>eps</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>etx</extension>
    <mime-type>text/x-setext</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>exe</extension>
    <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gif</extension>
    <mime-type>image/gif</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gtar</extension>
    <mime-type>application/x-gtar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gz</extension>
    <mime-type>application/x-gzip</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hdf</extension>
    <mime-type>application/x-hdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hqx</extension>
    <mime-type>application/mac-binhex40</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>htc</extension>
    <mime-type>text/x-component</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>htm</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hqx</extension>
    <mime-type>application/mac-binhex40</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ief</extension>
    <mime-type>image/ief</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jad</extension>
    <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jar</extension>
    <mime-type>application/java-archive</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>java</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jnlp</extension>
    <mime-type>application/x-java-jnlp-file</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpe</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpeg</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpg</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>js</extension>
    <mime-type>text/javascript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jsf</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jspf</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>kar</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>latex</extension>
    <mime-type>application/x-latex</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>m3u</extension>
    <mime-type>audio/x-mpegurl</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mac</extension>
    <mime-type>image/x-macpaint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>man</extension>
    <mime-type>application/x-troff-man</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>me</extension>
    <mime-type>application/x-troff-me</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mid</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>midi</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mif</extension>
    <mime-type>application/x-mif</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mov</extension>
    <mime-type>video/quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>movie</extension>
    <mime-type>video/x-sgi-movie</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp1</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp2</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp3</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpa</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpe</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpeg</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpega</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpg</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpv2</extension>
    <mime-type>video/mpeg2</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ms</extension>
    <mime-type>application/x-wais-source</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>nc</extension>
    <mime-type>application/x-netcdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>oda</extension>
    <mime-type>application/oda</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pbm</extension>
    <mime-type>image/x-portable-bitmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pct</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pdf</extension>
    <mime-type>application/pdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pgm</extension>
    <mime-type>image/x-portable-graymap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pic</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pict</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pls</extension>
    <mime-type>audio/x-scpls</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>png</extension>
    <mime-type>image/png</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pnm</extension>
    <mime-type>image/x-portable-anymap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pnt</extension>
    <mime-type>image/x-macpaint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ppm</extension>
    <mime-type>image/x-portable-pixmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ppt</extension>
    <mime-type>application/powerpoint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ps</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>psd</extension>
    <mime-type>image/x-photoshop</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qt</extension>
    <mime-type>video/quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qti</extension>
    <mime-type>image/x-quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qtif</extension>
    <mime-type>image/x-quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ras</extension>
    <mime-type>image/x-cmu-raster</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rgb</extension>
    <mime-type>image/x-rgb</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rm</extension>
    <mime-type>application/vnd.rn-realmedia</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>roff</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rtf</extension>
    <mime-type>application/rtf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rtx</extension>
    <mime-type>text/richtext</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sh</extension>
    <mime-type>application/x-sh</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>shar</extension>
    <mime-type>application/x-shar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>smf</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sit</extension>
    <mime-type>application/x-stuffit</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>snd</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>src</extension>
    <mime-type>application/x-wais-source</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sv4cpio</extension>
    <mime-type>application/x-sv4cpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sv4crc</extension>
    <mime-type>application/x-sv4crc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>swf</extension>
    <mime-type>application/x-shockwave-flash</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>t</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tar</extension>
    <mime-type>application/x-tar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tcl</extension>
    <mime-type>application/x-tcl</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tex</extension>
    <mime-type>application/x-tex</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>texi</extension>
    <mime-type>application/x-texinfo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>texinfo</extension>
    <mime-type>application/x-texinfo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tif</extension>
    <mime-type>image/tiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tiff</extension>
    <mime-type>image/tiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tr</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tsv</extension>
    <mime-type>text/tab-separated-values</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ulw</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ustar</extension>
    <mime-type>application/x-ustar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xbm</extension>
    <mime-type>image/x-xbitmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xht</extension>
    <mime-type>application/xhtml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xhtml</extension>
    <mime-type>application/xhtml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xml</extension>
    <mime-type>text/xml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xpm</extension>
    <mime-type>image/x-xpixmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xsl</extension>
    <mime-type>text/xml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xwd</extension>
    <mime-type>image/x-xwindowdump</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>wav</extension>
    <mime-type>audio/x-wav</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>svg</extension>
    <mime-type>image/svg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>svgz</extension>
    <mime-type>image/svg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>vsd</extension>
    <mime-type>application/x-visio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- Wireless Bitmap -->
    <extension>wbmp</extension>
    <mime-type>image/vnd.wap.wbmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- WML Source -->
    <extension>wml</extension>
    <mime-type>text/vnd.wap.wml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- Compiled WML -->
    <extension>wmlc</extension>
    <mime-type>application/vnd.wap.wmlc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- WML Script Source -->
    <extension>wmls</extension>
    <mime-type>text/vnd.wap.wmlscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- Compiled WML Script -->
    <extension>wmlscriptc</extension>
    <mime-type>application/vnd.wap.wmlscriptc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>wrl</extension>
    <mime-type>x-world/x-vrml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>Z</extension>
    <mime-type>application/x-compress</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>z</extension>
    <mime-type>application/x-compress</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>zip</extension>
    <mime-type>application/zip</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
    after all this i have taken a jsp page whose code is here:
    (the mysql database used is named as "testdb" and the table name is "user" which is having fields name,password and id)
    <html>
    <head>
    <title>DB Test</title>
    </head>
    <body>
    <%
    TestSQLLoad tst = new TestSQLLoad ( );
    tst.init();
    %>
    <h2>Results</h2>
    User <%= tst.getUser() %>
    Pwd <%= tst.getPassword() %>
    Id <%= tst.getID() %>
    </body>
    </html>
    and placed it in to the Tomcat 5.5\webapps\tomcat-docs\testdb directory and saved as test-db.jsp
    when i run this page on the browser i get a lot may errors stating
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
    AND NOW WHEN just to get rid of such errords i try to include a statement
    <%@ page import="pkg.TestSQLLoad" %> in the jsp page code (and also place the MySQLLoad.class file in a folder called pkg and place it in the same directory where the jsp page is )and make it look like
    <html>
    <head>
    <%@ page import="pkg.TestSQLLoad" %>
    <title>DB Test</title>
    </head>
    <body>
    <%
    TestSQLLoad tst = new TestSQLLoad ( );
    tst.init();
    %>
    <h2>Results</h2>
    User <%= tst.getUser() %>
    Pwd <%= tst.getPassword() %>
    Id <%= tst.getID() %>
    </body>
    </html>
    now when i run it i get the following errors:
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    Only a type can be imported. pkg.TestSQLLoad resolves to a package
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    in response to the above error i have even tried placing the MySQLLoad.class directly in the testdb folder along with the jsp page without keeping it in a package named pkg and then importing directly as <@page import="MySQLLoad" %>
    that too gave me the following errors
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    The import TestSQLLoad cannot be resolved
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    and if i do not use the statement <%@ page import="MySQLLoad"%> then also i get the errors like
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 11 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 11 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    THE 2nd Method:
    in my second method i did the same changes in the web.xml and server.xml
    then i took a jsp page with the following code:
    <%@ page import="javax.sql.*,java.sql.*,javax.naming.*,com.mysql.jdbc.*" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> trial doc </TITLE>
    </HEAD>
    <BODY>
    <h1>Trial Document</h1>
    <% InitialContext context=new InitialContext( );
    DataSource dataSource=(DataSource) context.lookup("java:comp/env/jdbc/testdb");
    Connection conn=dataSource.getConnection();
    Statement stmt=conn.createStatement();
    ResultSet rset=stmt.executeQuery("select * from user");
    if (rset.next()){
    %>
    <table width="100%" border="1">
    <tr align="left">
    <th>name</th> <th>password</th><th>id</th>
    </tr>
    <%
    do {
    %>
    <tr><td> <%=rset.getString(1)%> </td>
    <td><%=rset.getString(2) %></td>
    <td><%=rset.getString(3) %></td></tr>
    <%
    } while (rset.next());
    %>
    </table>
    <%
    } else{
    %>
    No results from query
    <%
    rset.close();
    stmt.close();
    conn.close();
    context.close();
    %>
    </BODY>
    </HTML>
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 15 in the jsp file: /testdb/Big1.jsp
    Generated servlet error:
    The type Connection is ambiguous
    An error occurred at line: 15 in the jsp file: /testdb/Big1.jsp
    Generated servlet error:
    The type Statement is ambiguous
    An error occurred at line: 15 in the jsp file: /testdb/Big1.jsp
    Generated servlet error:
    The type ResultSet is ambiguous
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(C

    thanx for ur response
    as u said that the problem is more of a jsp page not getting compiled....
    me also pointed towards the similar situation providing all the surrounding situations
    which i have met and gone through
    i m still thinking that problem may b in the tomcat's server.xml and web.xml as well
    so better if u plz guide me in that regard
    regards,
    kuldeep

  • ERROR in JDBC API TUTORIAL using finally

    According to the jdbc api tutorial and reference, the way to close a pooled connection is to use a try/catch/finally block as follows:
    try{
    Connection con = ds.getConnection("login", "password");
    // ... code to use the connection
    catch(SQLException sqle){
    finally {
    if (con != null) con.close()
    HOWEVER it seems that u cannot call close() on con because it can throw an SQLException which is not caught. The compiler issues the following error:
    "unreported exception java.sql.SQLException; must be caught or declared to be thrown con.close();"
    Does anyone know how to remedy this

    try /catch the con.close,and you also can realize it by declaring the method by
    "thows SQLException"

  • We're running a script using several employee API's which is failing..

    Hello.
    Hopefully, one of you gurus will have xome across this before...
    Our script has been created to take both NEW & CHANGED employee details into ORACLE Financials via a temporary table directly loaded in from our HR system. It has been working thus far for any new employees but is now failing now that we're trying to incorporate existing employees.
    The error message given is:
    ORACLE error occurred processing record.. ORA-20001: PAY_7599_SYS_SUP_DT_OUTDAT
    The official description behind the error is:
    ORA-20001: Supervisor is not valid for the duration of the assignment
    Metalink states “Using UPDATE_EMP_ASG API to update the supervisor on a person's assignment when the supervisor is hired after the Employee”. To get around this the DATETRACK mode needs to be set to UPDATE. However Shared HR users are only allowed to use the mode of CORRECTION for this API. We are, unfortunately, a Shared HR User.
    Basically, as I understand it, it is because we're trying to load in employees who have a start date BEFORE that of the Supervisor that we’re attaching it to.
    Please could you suggest/supply a workaround for users in this type of situation.
    /* Formatted on 2009/04/29 11:52 (Formatter Plus v4.8.7) */
    SET serveroutput ON SIZE 1000000 FORMAT WRAPPED
    SET verify OFF
    SET feedback OFF
    DECLARE
    -- Debugging/error handling
    -- Work variables
       location_code_errors  exception;
    --   emp_status_errors1   exception;
    --   emp_status_errors2   exception;
      v_emp_no number;
       l_employ_start_date        DATE:= TO_DATE ('01-APR-1999', 'DD-MON-YYYY');
       v_ora_loc_code number                     := 0;
       p_emp_number                     VARCHAR2 (14);
       v_rec_cnt                        NUMBER                          := 0;
       insert_flag                      VARCHAR2 (8);
       err_num                          NUMBER;
       err_msg                          VARCHAR2 (150);
       err_line                         VARCHAR2 (350);
       err_seq                          NUMBER                          := 0;
       l_validate                       BOOLEAN                     DEFAULT FALSE;
       l_std_business_group_id          NUMBER                          := '0';
       l_default_code_comb_id           NUMBER                        := '218048';
       l_organization_id                NUMBER                          := '0';
       l_set_of_books_id                NUMBER                          := '1';
       l_job_id                         NUMBER                          := '10';
       l_obj                            NUMBER;
       l_datetrack_update_mode          VARCHAR2 (30)             := 'CORRECTION';
       l_assignment_sequence            NUMBER;
       l_name_combination_warning       BOOLEAN                         := FALSE;
       l_assign_payroll_warning         BOOLEAN                         := FALSE;
       l_org_now_no_manager_warning     BOOLEAN;
       l_other_manager_warning          BOOLEAN;
       l_spp_delete_warning             BOOLEAN;
       l_entries_changed_warning        VARCHAR2 (30);
       l_tax_district_changed_warning   BOOLEAN;
       l_person_id                      NUMBER;
       l_assignment_id                  NUMBER;
       l_assignment_id2           NUMBER;  -- := '28262';
       l_special_ceiling_step_id        NUMBER;
       l_per_effective_end_date         DATE:= TO_DATE ('11-Jul-2049', 'DD-MON-YYYY');
       l_people_group_id                NUMBER;
       l_group_name                     VARCHAR2 (30);
       l_assignment_number              VARCHAR2 (35);
       l_effective_end_date             DATE := TO_DATE ('11-Jul-2049', 'DD-MON-YYYY');
       l_date                           DATE                           := SYSDATE;
       ip_p_address_id                  per_addresses.address_id%TYPE;
       ip_p_object_version_number       NUMBER;
       ip_p_party_id                    per_addresses.party_id%TYPE;
       l_per_object_version_number      NUMBER;
       l_asg_object_version_number      NUMBER;
       l_full_name                      VARCHAR2 (240);
       l_per_comment_id                 NUMBER;
       l_per_effective_start_date       DATE;
       l_concatenated_segments          VARCHAR2 (240);
       l_soft_coding_keyflex_id         NUMBER;
       l_comment_id                     NUMBER;
       l_no_managers_warning            BOOLEAN;
    -- Get employee details info from work table
       CURSOR get_employee_details
       IS
          SELECT std_hire_date, std_last_name, std_sex, std_date_of_birth,
                 std_email_address, std_emp_status,
                 LPAD (std_employee_number, 8, '0') std_employee_number,
                 std_first_name, std_marital_status, std_middle_names,
                 std_nationality, std_title, std_national_identifier,
                 std_address_line1, std_address_line2, std_address_line3,
                 std_address_line4, std_post_code, std_telephone_1, std_country, --std_region,
                 std_location_id, --std_organization_id,
                 lpad(std_supervisor_id,8,'0') std_supervisor_id
         --, std_person_id, std_position_id
            FROM SU_TEMPLOYEE_DETAILS     
         WHERE std_employee_number IS NOT NULL AND std_national_identifier IS NOT NULL;
    -- checks employee details info from PER_ALL_PEOPLE_F table
       CURSOR c_check_employee (p_emp_number VARCHAR2, p_NI_number Varchar2)
       IS
          SELECT per.person_id, per.business_group_id, per.last_name,
                 per.start_date, per.date_of_birth, per.email_address,
                 per.employee_number, per.first_name, per.marital_status,
                 per.middle_names, per.nationality, per.national_identifier,
                 per.sex, per.title, padd.address_id, padd.primary_flag,
                 padd.address_line1, padd.address_line2, padd.address_line3,
                 padd.town_or_city, padd.postal_code, padd.telephone_number_1, paas.assignment_id,
                 paas.assignment_number, paas.object_version_number, paas.EFFECTIVE_START_DATE,
         paas.job_id, paas.position_id, paas.location_id, paas.organization_id, paas.assignment_type, paas.supervisor_id,
                 paas.default_code_comb_id, paas.set_of_books_id, paas.period_of_service_id
          FROM   per_all_people_f per,
                 per_all_assignments_f paas,
                 per_addresses padd
           WHERE padd.person_id = per.person_id
           AND paas.person_id(+) = per.person_id
         AND per.employee_number = p_emp_number
         AND per.national_identifier = p_NI_number;
       emp_rec                          c_check_employee%ROWTYPE;
    -- Cursor retrieves latest Object Version Number from per_assignments_f table..
    --   CURSOR csr_ovn (cp_person_id IN per_all_people_f.person_id%TYPE)
         CURSOR csr_ovn (cp_person_emp_no IN per_all_people_f.EMPLOYEE_NUMBER%TYPE)
        IS
          SELECT MAX (paas.object_version_number)
            FROM per_assignments_f paas, per_all_people_f per
           WHERE paas.person_id = per.person_id
             AND per.employee_number = paas.assignment_number
            -- AND per.person_id = cp_person_id;
            AND employee_number = cp_person_emp_no;
    -- Cursor to get Oracle_Loc_Code from SU CHRIS vs ORACLE Locations Table into a variable..
    CURSOR csr_ora_loc_code (cp_location_id IN SU_TEMPLOYEE_DETAILS.std_location_id%TYPE)
    IS
          SELECT sil.ORACLE_LOC_CODE
         FROM SU_TEMPLOYEE_DETAILS std, SU_IEXP_LOCATIONS sil
         WHERE std.STD_LOCATION_ID = sil.CHRIS_LOC_code
         AND std.STD_LOCATION_ID = cp_location_id;
    BEGIN
    -- Process each record in the work table
       FOR v_emp IN get_employee_details
       LOOP
    -- Obtain the most recent Object Version Number..
           OPEN csr_ovn (v_emp.std_employee_number);
          FETCH csr_ovn
           INTO l_obj;
          IF csr_ovn%NOTFOUND     THEN        RAISE NO_DATA_FOUND;   END IF;
          CLOSE csr_ovn;
    -- determine whether customer already exists
          OPEN c_check_employee (v_emp.std_employee_number, v_emp.std_national_identifier);
          FETCH c_check_employee
           INTO emp_rec;
           v_emp_no :=  LPAD (v_emp.std_employee_number, 8, '0');
           l_assignment_id2 := emp_rec.assignment_id;
          IF v_emp.std_emp_status = 'N'  and c_check_employee%NOTFOUND
          THEN
          insert_flag := 'I';
              DBMS_OUTPUT.PUT_LINE ('Employee No: ' || v_emp.std_employee_number);
              DBMS_OUTPUT.PUT (CHR (10));
           END IF;
         --If Chris21 status is New but Employee exists in Finance make it a changed record
          IF v_emp.std_emp_status = 'N'  and c_check_employee%FOUND
          THEN
          insert_flag := 'C';
              DBMS_OUTPUT.PUT_LINE ('Employee No: ' || v_emp.std_employee_number);
              DBMS_OUTPUT.PUT (CHR (10));
           END IF;
          IF  v_emp.std_emp_status = 'C' and c_check_employee%NOTFOUND
          THEN
          insert_flag := 'I';
          DBMS_OUTPUT.PUT_LINE ('Employee No: ' || v_emp.std_employee_number || ' doesnt exist but            theyre goin in anyway.. ');
           DBMS_OUTPUT.PUT (CHR (10));
          END IF;
           IF v_emp.std_emp_status = 'C' and c_check_employee%FOUND
          THEN    
           insert_flag := 'C';
            END IF;
    --==================================================
    --===== Left this out as this was predominantly for testing purposes.. ======
    --==================================================
           --    IF l_assignment_id2 is null then   raise emp_status_errors1;     END IF;
           --    IF l_obj is null then  raise emp_status_errors2;    END  IF;
          --     IF l_job_id is null AND v_emp.std_emp_status = 'C'  THEN l_job_id = '10';
            -- END IF;
            -- END IF;
          CLOSE c_check_employee;
    -- Open Oracle Location Code cursor
    OPEN csr_ora_loc_code(v_emp.std_location_id); 
          FETCH csr_ora_loc_code
           INTO v_ora_loc_code;
           IF csr_ora_loc_code%NOTFOUND  THEN    RAISE   location_code_errors; END IF;
          CLOSE csr_ora_loc_code;
    -- Create new PER_ALL_PEOPLE_F and PER_ADDRESSES record from
    --            info in  table record
          IF insert_flag = 'I'
          THEN
    --                      -- Importing Employee Procedure --
             Hr_Employee_Api.create_gb_employee
                     (p_validate                       => l_validate,
                      p_hire_date                      => l_employ_start_date,
                      p_business_group_id              => l_std_business_group_id,
                      p_date_of_birth                  => v_emp.std_date_of_birth,
                      p_email_address                  => v_emp.std_email_address,
                      p_first_name                     => v_emp.std_first_name,
                      p_middle_names                   => v_emp.std_middle_names,
                      p_last_name                      => v_emp.std_last_name,
                      p_sex                            => v_emp.std_sex,
                      p_ni_number                      => v_emp.std_national_identifier,
                      p_employee_number                => v_emp.std_employee_number,
                      p_person_id                      => l_person_id,
                      p_title                          => v_emp.std_title,
                      p_assignment_id                  => l_assignment_id,
                      p_per_object_version_number      => l_per_object_version_number,
                      p_asg_object_version_number      => l_asg_object_version_number,
                      p_per_effective_start_date       => l_per_effective_start_date,
                      p_per_effective_end_date         => l_per_effective_end_date,
                      p_full_name                      => l_full_name,
                      p_per_comment_id                 => l_per_comment_id,
                      p_assignment_sequence            => l_assignment_sequence,
                      p_assignment_number              => l_assignment_number,
                      p_name_combination_warning       => l_name_combination_warning,
                      p_assign_payroll_warning         => l_assign_payroll_warning
             Hr_Person_Address_Api.create_person_address
                                      (p_validate                     => l_validate,
                        --            p_effective_date               => v_emp.std_hire_date,
                                       p_effective_date              =>  l_employ_start_date,
                                       p_pradd_ovlapval_override      => NULL,
                                       p_validate_county              => NULL,
                                       p_person_id                    => l_person_id,
                                       p_primary_flag                 => 'Y',
                                       p_style                        => 'GB_GLB',
                                       p_date_from                    => SYSDATE,
                                       p_date_to                      => NULL,
                                       p_address_type                 => NULL,
                                       p_comments                     => NULL,
                                       p_address_line1                => v_emp.std_address_line1,
                                       p_address_line2                => v_emp.std_address_line2,
                                       p_address_line3                => v_emp.std_address_line3,
                                       p_town_or_city                 => v_emp.std_address_line4,
                                       p_region_1                     => NULL,
                                       p_region_2                     => NULL,
                                       p_region_3                     => NULL,
                                       p_postal_code                  => v_emp.std_post_code,
                                       p_country                      => v_emp.std_nationality,
                                       p_telephone_number_1           => NULL,
                                       p_telephone_number_2           => NULL,
                                       p_telephone_number_3           => NULL,
                                       p_party_id                     => ip_p_party_id,
                                       p_address_id                   => ip_p_address_id,
                                       p_object_version_number        => l_obj
             Hr_Assignment_Api.update_emp_asg
                            (p_validate                    => l_validate,
                             p_effective_date              => SYSDATE,  -- l_date,
                             p_datetrack_update_mode       => l_datetrack_update_mode,
                             p_assignment_id               => l_assignment_id,
                             p_object_version_number       => l_obj,
                             p_supervisor_id               => v_emp.std_supervisor_id,
                             p_default_code_comb_id        => l_default_code_comb_id,
                             p_set_of_books_id             => l_set_of_books_id,
                             p_concatenated_segments       => l_concatenated_segments,
                             --IN/OUT
                             p_soft_coding_keyflex_id      => l_soft_coding_keyflex_id,
                             --IN/OUT
                             p_comment_id                  => l_comment_id,
                             --IN/OUT
                             p_effective_start_date        => l_date,     --IN/OUT
                             p_effective_end_date          => l_effective_end_date,
                             --IN/OUT
                             p_no_managers_warning         => l_no_managers_warning,
                             --IN/OUT
                             p_other_manager_warning       => l_other_manager_warning
                            --IN/OUT
             Hr_Assignment_Api.update_emp_asg_criteria
                 (p_validate                          => l_validate,
                  p_effective_date                    => SYSDATE,       -- l_date,
                  p_datetrack_update_mode             => l_datetrack_update_mode,
                  p_assignment_id                     => l_assignment_id,
                  p_object_version_number             => l_obj,
                  p_organization_id                   => l_organization_id,
                  p_location_id                       => v_ora_loc_code,
                  p_job_id                            => l_job_id,
    --              p_position_id                       => v_emp.std_position_id,
                  p_special_ceiling_step_id           => l_special_ceiling_step_id,
                  p_effective_start_date              => l_date,
                  --per_effective_start_date,
                  p_effective_end_date                => l_effective_end_date,
                  --IN/OUT
                  p_people_group_id                   => l_people_group_id,
                  --IN/OUT
                  p_group_name                        => l_group_name,    --IN/OUT
                  p_org_now_no_manager_warning        => l_org_now_no_manager_warning,
                  --IN/OUT
                  p_other_manager_warning             => l_other_manager_warning,
                  --IN/OUT
                  p_spp_delete_warning                => l_spp_delete_warning,
                  --IN/OUT
                  p_entries_changed_warning           => l_entries_changed_warning,
                  --IN/OUT
                  p_tax_district_changed_warning      => l_tax_district_changed_warning
                 --IN/OUT
             v_rec_cnt := v_rec_cnt + 1;
             DBMS_OUTPUT.PUT (CHR (10));
             DBMS_OUTPUT.PUT_LINE (   'There were '
                                   || v_rec_cnt
                                   || '  records read in..'
    -- Updating PER_ALL_PEOPLE_F and PER_ADDRESSES record from
    --            info in  table record
       ELSE IF insert_flag = 'C'
          THEN
              DBMS_OUTPUT.PUT (CHR (10));
             DBMS_OUTPUT.PUT_LINE ('Employee No: ' || v_emp.std_employee_number ||  '  is about to be updated.. '   );
              DBMS_OUTPUT.PUT (CHR (10));
    -- ===================================================
    -- these next 6 lines is for the initial mass update of existing employee records only     
    -- ===================================================
    /*IF emp_rec.default_code_comb_id is NULL THEN
         l_default_code_comb_id = 218048;
         END IF;     
         IF emp_rec.job_id is NULL THEN
         l_job_id = 10;
         END IF;      */
    -- =========
    -- Section end
    -- =========
             Hr_Assignment_Api.update_emp_asg
                            (p_validate                    => l_validate,
                             p_effective_date           => emp_rec.EFFECTIVE_START_DATE, --SYSDATE,
                             p_datetrack_update_mode       => l_datetrack_update_mode,
                             p_assignment_id               => l_assignment_id2,
                             p_object_version_number       => l_obj,
                             p_supervisor_id               => v_emp.std_supervisor_id,
                              p_default_code_comb_id        => l_default_code_comb_id,
               --            p_default_code_comb_id        => emp_rec.default_code_comb_id,
                             p_set_of_books_id             => emp_rec.set_of_books_id,
                             p_concatenated_segments       => l_concatenated_segments,
                             --IN/OUT
                             p_soft_coding_keyflex_id      => l_soft_coding_keyflex_id,
                             --IN/OUT
                             p_comment_id                  => l_comment_id,
                             --IN/OUT
                             p_effective_start_date        => l_date,     --IN/OUT
                             p_effective_end_date          => l_effective_end_date,
                             --IN/OUT
                             p_no_managers_warning         => l_no_managers_warning,
                             --IN/OUT
                             p_other_manager_warning       => l_other_manager_warning
                            --IN/OUT
             Hr_Assignment_Api.update_emp_asg_criteria
                 (p_validate                          => l_validate,
                  p_effective_date                    => emp_rec.EFFECTIVE_START_DATE,
                  --p_effective_date                    => SYSDATE,
                  p_datetrack_update_mode             => l_datetrack_update_mode,
                  p_assignment_id                     => l_assignment_id2,
                  p_object_version_number             => l_obj,
    --              p_organization_id                   => emp_rec.organization_id,
                  p_organization_id                   => l_organization_id,
                  p_location_id                       => v_ora_loc_code,
                  p_job_id                            => emp_rec.job_id,
    --              p_position_id                       => emp_rec.position_id,
                  p_special_ceiling_step_id           => l_special_ceiling_step_id,
                  p_effective_start_date              => emp_rec.EFFECTIVE_START_DATE,
                  p_effective_end_date                => l_effective_end_date,
                  --IN/OUT
                  p_people_group_id                   => l_people_group_id,
                  --IN/OUT
                  p_group_name                        => l_group_name,    --IN/OUT
                  p_org_now_no_manager_warning        => l_org_now_no_manager_warning,
                  --IN/OUT
                  p_other_manager_warning             => l_other_manager_warning,
                  --IN/OUT
                  p_spp_delete_warning                => l_spp_delete_warning,
                  --IN/OUT
                  p_entries_changed_warning           => l_entries_changed_warning,
                  --IN/OUT
                  p_tax_district_changed_warning      => l_tax_district_changed_warning
                 --IN/OUT
             v_rec_cnt := v_rec_cnt + 1;
             DBMS_OUTPUT.PUT (CHR (10));
             DBMS_OUTPUT.PUT_LINE (   'There were '
                                   || v_rec_cnt
                                   || ' records read in..'
             DBMS_OUTPUT.PUT (CHR (10));
    -- End of customer related details
          END IF;
          END IF;
    --      END IF;
       END   LOOP;
       COMMIT;
    EXCEPTION
    WHEN  location_code_errors THEN  ROLLBACK;
    dbms_output.put_line  ('Location ID unknown or not found, please check..');
    /* WHEN  emp_status_errors1 THEN  ROLLBACK;
    dbms_output.put_line  ( 'Employee No: ' || v_emp_no || ' has been found but has no assignment id2!') ;
    WHEN  emp_status_errors2 THEN  ROLLBACK;
    dbms_output.put_line  ( 'Employee No: ' || v_emp_no  || ' Assgnmnt Obj Vers No is not being passed!');
       WHEN NO_DATA_FOUND     THEN     ROLLBACK;
          err_num := TO_CHAR (SQLCODE);
          err_msg := SUBSTR (SQLERRM, 1, 150);
          err_line :=   'ORACLE error occurred processing record.. ' ||  err_msg;
          DBMS_OUTPUT.PUT_LINE (err_line);
          INSERT INTO SU_ERROR_LOG  VALUES (err_msg, 'TEMPLOYEE_DTLS.sql', SYSTIMESTAMP);
        WHEN OTHERS    THEN       ROLLBACK;
          err_num := TO_CHAR (SQLCODE);
          err_msg := SUBSTR (SQLERRM, 1, 150);
          err_line :=   'ORACLE error occurred processing record.. ' ||  err_msg;
          DBMS_OUTPUT.PUT_LINE (err_line);
          INSERT INTO SU_ERROR_LOG  VALUES (err_msg, 'TEMPLOYEE_DTLS.sql', SYSTIMESTAMP);
    END;
    EXIT;Many thanks..
    Steven

    many thanks for your help user11181328 but because its just a SQL script I thought an alternative was to create 2 cursors in the same script to get the date..:
    1st cursor to -- 1. First get the assignment id of the subordinate. (emp_rec.assignment_id)
    ..and then 2nd to: get the start date of the supervisor's record (v_emp.std_supervisor_id)
    -- Cursor to get Oracle_Loc_Code from SU CHRIS vs ORACLE Locations Table into a variable..
    CURSOR csr_ora_loc_code (cp_location_id IN SU_TEMPLOYEE_DETAILS.std_location_id%TYPE)
    IS
          SELECT sil.ORACLE_LOC_CODE
         FROM SU_TEMPLOYEE_DETAILS std, SU_IEXP_LOCATIONS sil
         WHERE std.STD_LOCATION_ID = sil.CHRIS_LOC_code
         AND std.STD_LOCATION_ID = cp_location_id;
    -- Cursor to get the start date of the supervisor's record based
    -- on the assignment id of the subordinate (employee)
    -- 1. First get the assignment id of the subordinate. (emp_rec.assignment_id)
    CURSOR c_sprvsrid_ofemp (p_emp_number VARCHAR2)
    IS
    SELECT paas.assignment_id --  per.EMPLOYEE_NUMBER
    FROM per_all_people_f per, per_assignments_f paas
    WHERE
    paas.person_id = per.person_id
    AND per.employee_number = p_emp_number;
       sprvsr_rec                          c_sprvsrid_ofemp%ROWTYPE;
    -- 2. from this get the start date of the supervisor's record (v_emp.std_supervisor_id)
    CURSOR c_sprvsr_strt_dte (p_emp_number VARCHAR2)
    IS
    SELECT   paas.effective_start_date 
    FROM per_all_people_f per, per_assignments_f paas
    WHERE
    paas.person_id = per.person_id
    AND per.employee_number = paas.assignment_number
    --AND paas.assignment_id = sprvsr_rec.SUPERVISOR_ID;
    AND paas.assignment_id = sprvsr_rec.assignment_id;
       ssdate_rec                          c_sprvsr_strt_dte%ROWTYPE;
    -- 3. then take this start date in [2] and give it to the start date of the assignment for the subordinate....then in the main section..
    -- Get that bloody Supervisors start date!!
    OPEN c_sprvsrid_ofemp (emp_rec.employee_number);
          FETCH c_sprvsrid_ofemp        INTO sprvsrid_ofemp;
        --  IF c_sprvsrid_ofemp%NOTFOUND     THEN        RAISE NO_DATA_FOUND;   END IF;
         CLOSE c_sprvsrid_ofemp;
    OPEN c_sprvsr_strt_dte (emp_rec.employee_number);
        FETCH c_sprvsr_strt_dte INTO v_sprvsr_strt_dte;     
    -- IF c_sprvsr_strt_dte%NOTFOUND     THEN        RAISE NO_DATA_FOUND;   END IF;
       CLOSE c_sprvsr_strt_dte;Alas, although it seemed written out to work, the same error message was generated when ran. I have honestly no idea how to get around this. Metalink acknowledge its a problem but have placed it as an 'Enhancement Request', meaning of course, don't wait up for a fix anytime this year..
    Steven

  • Using VB API in VBA to edit the Calc Scripts

    Guys,
    Does anyone of you have VBA source code/examples utilizing Essbase API for the following operation.
    I want to copy Calc Script from Server to the client, edit the Script using VBA and copy back the Script to the Server. Any kind of info is appreciated.
    Thanks in advance
    HYPuser

    I posted some real sample code a while back for a completely different function (member renames).
    Renaming Existing Member Names
    So while you'll have to write the calc modification code yourself (or ask Glenn his rate ;-)), this at least shows you how the initialization / login / termination of the API would work. That's probably the most confusing aspect of using the VB API for the first time anyway.
    All that said, if this is from Excel and the user will already be logged in via the Excel Add-In, I believe that you can make life much easier and grab the hCtx directly without any initialization / login/ termination worries. I probably should have done that myself in the example I gave. See Tim Tow's posts in this thread:
    API
    EDIT: Two things I just noticed - first, the code sample I gave even has an example of polling for ProcState, so that gets you closer than I thought! Second, remembered that the line that reads...
    While ProcState.State ESB_STATE_DONE
    ...should actually have a 'less than / greater than' symbol between ProcState.State and ESB_STATE_DONE. Can't get the forum to display them correctly, even in code tags...
    Edited by: TimG on May 16, 2011 2:55 PM

  • Can't Connect to the Mysql Database using J2SE jdk1.5

    Can anyone tell me why this error occurs ????????????????????
    Following are the codes ;
    package dbconnect2;
    import java.sql.*;
    public class dbconn2 {
    public static final String URL =
    "jdbc:mysql://localhost:3306/test";
    public static final String USERNAME = "test";
    public static final String PASSWORD = "password";
    * @param args the command line arguments
    public static void main(String[] args) throws Exception {
    // TODO code application logic here
    Connection connection = null;
    try {
    Class.forName("com.mysql.jdbc.Driver");
    connection = DriverManager.getConnection(URL,
    USERNAME, PASSWORD);
    Statement stm = connection.createStatement();
    ResultSet rs = stm.executeQuery("select * from emp");
    while (rs.next())
    String strnaam = rs.getString("emp_name");
    System.out.println(strnaam);
    finally {
    if (connection != null)
    connection.close();
    ================================================================================
    This is the run time error ;
    init:
    deps-jar:
    compile:
    run:
    Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at dbconnect2.dbconn2.main(dbconn2.java:39)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    please help me to sort this out
    Thanks
    Sishani

    I've solved the DW problem by changing the site folders from
    'db' to 'wwwroot' e.g. 'C:\CFusionMX\db\' is now
    'C:\CFusionMX\wwwroot\
    However I'm now back to my original problem. I've lost my
    mqysql connection in CF Adminstrator. Before I made these changes I
    could connect to my mysql databases using the following settings:
    JDBC URL: jdbc:mysql://localhost:3306/test
    Driver Name: MySQL Connector J
    using the following Java path and file:
    C:\CFusionMX\wwwroot\WEB-INF\lib\mysql-connector-java-3.0.17-ga-bin.jar
    Now these settings give me the following error:
    "Connection verification failed for data source: javaserver
    []java.sql.SQLException: SQLException occurred in JDBCPool
    while attempting to connect, please check your username, password,
    URL, and other connectivity info.
    The root cause was that: java.sql.SQLException: SQLException
    occurred in JDBCPool while attempting to connect, please check your
    username, password, URL, and other connectivity info"
    Any suggestions on this would also be welcome.
    Thanks again to everyone for their help.
    Sincerely,
    Graham A. Kerby

  • Who will implement jdbc api interface?

    Hi Friends,
    I have One doubt on jdbc api interface,
    I will Explait it clearly
    Through java if we want connect any database we need to use JDBC,
    To conne to database,
    We need to load the driver and
    we need to establish the connection and
    we need to execute some Query,ryte...
    My exact doubt is...
    the Connection class and the total JDBC API is interface,
    to connect to the database,We need to use the above mentioned procedure but they are all interfaces,So those jdbc related interface must be implemented by someone.
    But who is going to implement that interface?
    I am very much confusing with this,
    Can anybody help me out regarding this with an Example.........
    Regards,
    Anji.

    Yes, the specific JDBC driver you use provides the implementation/concrete classes. So if you are using a oracle jdbc driver to connect to an oracle database, then as in your example:
    Connection con= DriverManager.getConnetion("--------");will result in an Oracle Specific implementation connection class (say: OracleConnection) being associated with your connection. Since OracleConnection implements Connection, you can interact with it through this interface. If for some reason, you database changes to MySQL you can simply replace the JDBC driver and your call to "getConnection" will now return the MySQL implementation class without having to change all the code that uses the connection since the MySQL connection class uses the same interface.
    In the same way, the JDBC driver has implementation classes for all the interfaces defined in the JDBC API (which you do not, and should not interact with directly). The driver will provide the correct implementation classes for your interfaces at runtime and you access them through their interface.

  • About JDBC API

    "The JDBC API contains two major sets of interfaces:
    the first is the JDBC API for application writers,
    and the second is the lower-level JDBC driver API for driver writers.
    Applications and applets can access databases via the JDBC API using pure Java JDBC technology-based drivers."
    You can read this in the sun web site.
    When I have downloaded a jdbc driver for mysql database
    I have looked for source code and found those classes that implement the different interfaces belonging to package java.sql:
    at this point I imagine that this driver implements the first of the two interfaces in the previous sentence.
    I have not understood when the driver API for driver writers enter in this schema and if the second interface is anyway necessary for interact with the database: I would think that the second interface is necessary and is built with the driver API for driver writers, API that I have never seen.
    What do you think about this?

    I was thinking the same but now I am not so sure.
    Are you sure that API that belong to JDBC Driver API are not simply those concerning the driver manager?
    Anyway, when I download the driver in order to speak with the database, are there JDBC Driver API too?
    If you had reason, and the second volume of my official tutorial seems confirm this, the two interfaces would be completly separate.
    And I can not imagine a API that help me writing a driver for any database. Which type of help could give me?

  • I don't get up-to-date data from mySQL with my JDBC connections

    Hi all,
    I have developped a server that uses 2 JDBC connections to mySQL. Those two connections are used by two different threads. Those connections are never closed. I just create a new Statement each time I want to make a query or an update, and commit after each update.
    1) If I modify data on my mySQL database with the first connection (UPDATE or DELETE), then my second connection doesn't see the modifications (using SELECT).
    2) And, if I use a different software to access my database on mySQL and make some modifications, my java application doesn't see the modifications in the database.
    In the two cases, my java application only see the changes in the mySQL database if I close the java application and launch it again.
    It's just like if a JDBC connection can see the modifications of the database it has itself made, but can't see modifications made by an other connection to the database... That sounds crazy, as most servers use connection pooling... What do I make wrong? Would you have any idea?
    Many thanks !

    Thank you for your answer.
    But no, it isn't a commit problem. I use InnoDB bases of mySQL, I use transactions, and I call the commit() method.
    For you or anybody to be able to try, I wrote some code. It creates 2 threads. The first thread write on DB and the other reads.
    package Tests;
    import java.sql.*;
    public class SQLConnections {
        private Thread internalThread1;   
        private Thread internalThread2;
        private Connection connection1;
        private Connection connection2;
        private static String driver = "org.gjt.mm.mysql.Driver";
        private static String database = "jdbc:mysql://223.186.6.12/test";
        private static String databaseLogin = "user";
        private static String databasePassword = "password";
        public SQLConnections() {
            // The thread that writes the SGBDR
            Runnable runner = new Runnable() {
                public void run() {
                    try {
                        // Launch the JDBC connection to the mySQL server.
                        Class.forName(driver).newInstance();
                        connection1 = DriverManager.getConnection (database, databaseLogin, databasePassword);
                        connection1.setAutoCommit(false);
                        synchronized ( internalThread1 ) {
                            internalThread1.sleep(10000);
                        while ( true ) {
                            Statement statement = connection1.createStatement();
                            statement.executeUpdate("INSERT INTO bike(color) VALUES('uniqueColor')");
                            connection1.commit();
                            System.out.println("                          ##### NEW LINE IN DB #####");
                            synchronized ( internalThread1 ) {
                                internalThread1.sleep(10000);
                    catch (Exception e) {
                        e.printStackTrace();
            internalThread1 = new Thread(runner);
            runner = null;
            internalThread1.setPriority(Thread.NORM_PRIORITY);
            internalThread1.start();
            // The thread that reads the SGBDR.
            runner = new Runnable() {
                public void run() {
                    try {
                        // Launch the JDBC connection to the mySQL server.
                        Class.forName(driver).newInstance();
                        connection2 = DriverManager.getConnection (database, databaseLogin, databasePassword);
                        connection2.setAutoCommit(false);
                        while ( true ) {
                            Statement statement = connection2.createStatement();
                            ResultSet result = statement.executeQuery("SELECT * FROM bike");
                            while ( result.next() )
                                System.out.println(result.getInt(1)+"    "+result.getString(2));                           
                            synchronized ( internalThread2 ) {
                                internalThread2.sleep(10000);
                    catch (Exception e) {
                        e.printStackTrace();
            internalThread2 = new Thread(runner);
            runner = null;
            internalThread2.setPriority(Thread.NORM_PRIORITY);
            internalThread2.start();
        public static void main(String[] args) {
            new SQLConnections();
    }Here is the result I get :
    [greg@ns32 Tests]$ /usr/java/j2re1.4.2_06/bin/java -classpath :mysql-connector-java-3.0.9-stable-bin.jar Tests.SQLConnections
    18 uniqueColor
    19 uniqueColor
    ##### NEW LINE IN DB #####
    18 uniqueColor
    19 uniqueColor
    ##### NEW LINE IN DB #####
    18 uniqueColor
    19 uniqueColor
    [greg@ns32 Tests]$ /usr/java/j2re1.4.2_06/bin/java -classpath :mysql-connector-java-3.0.9-stable-bin.jar Tests.SQLConnections
    18 uniqueColor
    19 uniqueColor
    20 uniqueColor
    21 uniqueColor
    ##### NEW LINE IN DB #####
    18 uniqueColor
    19 uniqueColor
    20 uniqueColor
    21 uniqueColor
    ##### NEW LINE IN DB #####
    18 uniqueColor
    19 uniqueColor
    20 uniqueColor
    21 uniqueColor
    [greg@ns32 Tests]
    I'm doing something stupid?????

  • Need to Use google APIs in View .htm Page

    Hi Experts,
    I have the following requirements:
    I need to capture the Geo code based on the user click from Google maps and update the same in the CRM.
    I need to load the Google maps with multiple Location Marking and Marking Icons will be changing based on some condition.
    I had implemented the Mash-ups to Load Google Maps in the WEB UI screen.
    I found that Mash-ups will be helpful only to load the web Page Via URL(parameters passing) and it will not return back any info.
    So i  created a custom view and write the Java Script logic which contain the Google APIs,functions to load the Maps dynamically with
    multiple Geocodes Etc., How ever while am loading the view in the CRM am not able to load the maps.
    So I create a Page with Flow Logic in the same BSP Component and i provide the same code which i given in View's .htm page,while testing its working fine.
    Q1 > Using Mashups in CRM can use the Google APIS and can we raise events on click on the Maps?
    Q2>  Why Java Scripts contain Google APIS are not loading in the View's .htm page like Pages with flow Logic.
    Q3>  How can i Load the Page with flow Logic in the View's .htm page with out using Iframe?
    Any Suggestion will be helpful.
    Thanks and Regards,
    Y. Ravi Kumar.

    Hi,
    I just wanted to post some of my experience on java.nio.channels.FileLock.
    If a file is in use by an application, for example if a jar file is launched, the file is obviously locked by the system in a way we can't delete it.
    However it is still considered as unlocked by java as an exclusive FileLock could be set.
    If an exclusive FileLock has been set on a file no other exclusive FileLock could be set by any other application. (relieved ! the basic lock operation works !)
    When a FileLock is set on a jar file it DEFINITELY corrupt the considered jar !!!!!
    the message "Invalid or corrupt jarfile" is displayed when I try to execute it using java
    and any zip utility can't open it any more.
    And it is not a locking problem !
    Even after the exit of the application that lock the file, release of the lock, copy of the considered jar, the jarfile is definitely corrupted.
    I guess it could/should be the same thing on other file types.
    What an awful bug :(
    My config is Windows Vista sp1
    java version "1.6.0_05"
    Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
    Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
    Considering the question "if I then use a FileLock and lock my file, can I still delete it?"
    The answer is no you can't delete it:
    You can't delete it with the application that locked it
    (not even with File.deleteOnExit() method -- still with the above config --)
    neither with another application.
    Of course you can release the lock and delete it ...

  • Help: Connecting Tomcat to CA-IDMS Using JDBC Type 4 Drivers (JNDI)

    Hi there,
    I have a rather interesting / complex problem......creating a connection to CA-IDMS from Tomcat using JDBC type 4 drivers (CA provide the type 4 driver).
    We have a zSeries 9 IBM mainframe running CA-IDMS r16.1, and I need to connect to the IDMS from Tomcat (running on Linux) using the JDBC Type 4 drivers provided by CA.
    At this stage I am struggling with the actual setup and configuration of Tomcat’s server.xml and web.xml files. These are the files where the JDBC configuration is set (I think). I have to setup the CA-IDMS part of the configuration, but that is a different problem. Basically there is a TCP/IP listener on the IDMS, waiting for incoming connections from the JDBC type 4 driver.
    I set up a Tomcat to MySQL connection using MySQL Connector / J, which is a similar kind of process to what I am trying to achieve with IDMS. MySQL connector / J came with a jar file which is placed in Tomcat’s lib folder, and then the JDBC setup for the web application is created in Tomcat's server.xml and web.xml files. You can then connect to the MySQL database using JSP and the configured JDBC driver / connection. The CA-IDMS Server comes with an idmsjdbc.jar file, which I think is the JDBC typr 4 driver. I think it needs to be placed in the Tomcat /lib folder, but I don’t know how to set up the configuration.
    There is a JDBC DriverManager which allows JDBC drivers to connect to CA-IDMS. The DriverManager recognises the following syntax:
    jdbc:idms://hostname:port/database
    This allows the JDBC driver running within Tomcat to connect to the IDMS which is running on the IDM mainframe. CA IDMS r16 supports direct connections from the Type 4 JDBC driver to the Central Version on IDMS. "hostname" is the DNS name or IP address of the machine where the CV is running, and "port" is the IP port that was specified for the listener PTERM (setup on the IDMS side).
    There is a caidms.properties file for the JDBC driver, which is used to specify user ID, password, and optional accounting information. It can also be used to specify physical connection information, allowing an application to connect to a CA-IDMS database without requiring the definition of an ODBC style data source. However, I don’t know where to place this file within the Tomcat setup.
    There is also an IdmsDataSource class. I don’t know where to configure this or how to set it up; the CA-IDMS Server manual states the following:
    This class implements the JDBC DataSource interface. It is used with an application server (Tomcat) providing Java Naming and Directory Interface (JNDI) naming service to establish a connection to a CA IDMS database. IdmsDataSource properties conform to the Java Beans naming conventions and are implicitly defined by public “setter” and “getter” methods. For example, the “description” property, which is required for all DataSource implementations, is set using the setDescription(String) method. The application server may use the java.lang.reflection methods to discover DataSource properties and provide an interface to set them, or may simply require that they are defined in some configuration file. IdmsDataSource properties are used to specify the connection parameters. These properties are the equivalent of the DriverPropertyInfo attributes described in the previous section and can be used to completely define the parameters needed to connect to a database. Like a URL, an IdmsDataSource object can also reference an “ODBC” style data source name, where the connection parameters are defined in the configuration file on Linux.
    Is there anyone that can try to point me in the right direction to setting up the JDBC connection? I am totally new to Java and so the instructions are not making much sense at the moment. Any help, hints, tips…..anything will be greatly appreciated as I have just hit a brick wall here. I can't find much to do with setting up the CA-IDMS Server JDBC type 4 driver online either....if anyone can point me to some resources that would also be extremely useful.
    Kind regards
    Jp

    You say you've managed to get the JDBC driver working
    in an application but not in a JSP. You also say that
    the error you get is
    "com.microsoft.jdbc.sqlserver.SQLServerDriver".
    I'd be willing to bet that the exception that you have
    got is a ClassNotFoundException. I.E. your application
    server hasn't found the JDBC driver classes. The
    application server probably doesn't use your current
    CLASSPATH to look for classes. It will be setup within
    the application server in some way and you'll need to
    check your app server documentation to see how it is
    done.
    Try replacing
    e.printStackTrace();with
    e.printStackTrace(out);to get a full stack trace of your error.
    ColTried it. Got this error when I tried to run the JSP.
    Incompatible type for method. Can't convert javax.servlet.jsp.JspWriter to java.io.PrintWriter.
              e.printStackTrace(out);
    I'm currently using Apache Tomcat 4.0.3 as my JSP/Servlet Container.
    I'm also using Type 4 MS SQL Server 2000 JDBC driver version 2.0 on my NT4.0 Server.
    Do I need to set my JDBC driver in my container? if so, how do I do that?

Maybe you are looking for

  • How can I delete a corrupted itunes library

    My iTunes was freezing at the beginning after I have tried to load some mp3 files. I got an advice to click "option" with the iTunes icon and I could build a new library. Now, How can I delete the old corrupted one which is almost 100Gb??

  • My ipod wont syng new stuff

    Ok I have a 5g ipod and have had it for a few years. This could have been going on for longer than I realized, but might not because from the start I had WAY more songs than I listened too haha. Anyway... I stopped using P2P programs on my main compu

  • Parent child deletion  in ODI

    Hi , I am using ODI for data migration. I have created interface for that . i have done error handling . now i need to implement parent child deletion. that is i need to delete parent record if the child record is no there for a particular Policy. ca

  • Internal oder and Cost Center

    Hi, i need to know , how many internal oder is in a center ? Please advise if you can pull list of internal oder which assigned to cost center> thanks a bunch peace

  • User exit for component data in ME21n/ME22n

    Hello, I have a requirement to issue an error message if a component quantity is not evenly divisible by the end item quantity.  The component data (BOM) is entered after clicking the components button on ME21n/ME22n at the item level detail.  I need