MySQL pooling different from PostgreSQL ?

With PostgreSQL I can define pooling datasources withou having to define any file configuration in tomcat server files, but I'm not beeing able to do this wit MySQL.
This is the code I'm using for PostgreSQL:
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import org.postgresql.ds.PGPoolingDataSource;
public class Log2DB {
     private static String dataSourceName = "PgSQL Log Database";
     private static String serverName = "localhost";
     private static String databaseName = "test":
     private static String userName = "test";
     private static String databasePassword = "test";
     public Log2DB() throws NamingException {
           PGPoolingDataSource source = new PGPoolingDataSource();
           source.setDataSourceName(dataSourceName);
           source.setServerName(serverName);
           source.setDatabaseName(databaseName);
           source.setUser(userName);
           source.setPassword(databasePassword);
           source.setMaxConnections(10);
           new InitialContext().rebind(dataSourceName, source);
     public void logPgSQLData(String sqlStatement) {
          Connection conn = null;
          try {
               DataSource source = (DataSource) new InitialContext()
                         .lookup(dataSourceName);
               conn = source.getConnection();
               conn.setAutoCommit(true);
               Statement statement = conn.createStatement();
               statement.cancel();
               statement.execute(sqlStatement);
          } catch (SQLException e) {
               System.err.println("Error connecting to database");
          } catch (NamingException e) {
               System.err.println("DataSource could not be found");
          } finally {
               if (conn != null) {
                    try {
                         conn.close();
                    } catch (SQLException e) {
                         System.err
                                   .println("Error closing the connection to the database");
}and this is the code for MySQL:
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
public class Log2DB {
     private static String dataSourceName = "MySQL Log Database";
     private static String serverName = "localhost";
     private static String databaseName = "test";
     private static String userName = "test";
     private static String databasePassword = "test";
     public Log2DB() throws NamingException {
           MysqlConnectionPoolDataSource mysqlPoolDataSource = new MysqlConnectionPoolDataSource();
           String connectionUrl = "jdbc:mysql://" + serverName + ":3306/"
           + databaseName;
           mysqlPoolDataSource.setUrl(connectionUrl);
           mysqlPoolDataSource.setServerName(serverName);
           mysqlPoolDataSource.setPort(3306);
           mysqlPoolDataSource.setDatabaseName(databaseName);
           mysqlPoolDataSource.setUser(userName);
           mysqlPoolDataSource.setPassword(databasePassword);
           new InitialContext().rebind(connectionUrl, mysqlPoolDataSource);
}When the code reaches the rebinfd it throws an Exception:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
One of the differences that I can immediatly see is that the MySQL Pool Class does not allow to define a DataSourceName, but I really don't know if this is the real problem...
Unfortunatelly I coulndn't find any examples or documentation on using "MysqlConnectionPoolDataSource", is this even possible?
I'm using the latest version of Java, Tomcat and MySQL and Postgres connectors.
Message was edited by:
pedro.silva

A better place to troll is the Database forum, General Database Discussions
Yes MTS is different from a connection pool. Oracle has a few different kinds of connection pools. The one that will work with PHP's multi-process architecture is the "Database Resident Connection Pool" planned for the next major release of the Oracle database.
-- cj

Similar Messages

  • Import data from postgreSQL into SQL server 2005

    I am trying to import one table from postgreSQL to SQL Server 2005 using sql server import and export wizard. When i test the connection after providing data source, location, username, password in the Data Link Properties section I get the message "Test Connection Succeeded". As soon as i press next to go onto next step i get the following error.
    TITLE: SQL Server Import and Export Wizard
    Cannot get string literals from the database connection "Provider=PostgreSQL.1;User ID=sa;Data Source=localhost;Location=TestMasterMap;Extended Properties=".
    ADDITIONAL INFORMATION:
    Object reference not set to an instance of an object. (DTSWizard)
    BUTTONS:
    OK
    I have tried all sorts of different combinations for these properties but it always fails on this step. Can anybody help me with this?
     

    The settings above worked for a small table with 3 rows. Now when I try to import the bigger table which I wanted to import in the first instance I get following out of memory error. Anybody knows how to work around this. I have checked my task manager and more than half of my memory was still not used when I get this error.
    TITLE: SQL Server Import and Export Wizard
    Column information for the source and destination data could not be retrieved.
    "Query" -> [temporary].[dbo].[exporttable]:
                      - ERROR [HY000] Out of memory while reading tuples.;
    No query has been executed with that handle
    ADDITIONAL INFORMATION:
    ERROR [HY000] Out of memory while reading tuples.;
    No query has been executed with that handle (PSQLODBC.DLL)
    BUTTONS:
    OK

  • PS CS5 Image Display Differs From Used ICC Profile In Win 7

    Hi,
    on my Windows 7 Ultimate x64 machine, I just calibrated my Dell SP2309W monitor using an i1DisplayPro and basICColor 5, creating a ICC v2 profile (I am aware of the problems under Windows with ICC v4 profiles).
    It created the ICC profile and applied it to be used by Windows. I double checked under COLOR MANAGEMENT that the new ICC profile is being used. Although I can see that the new ICC is being used (desktop appearance changes), there are a few issues I am experiencing:
    (1.) Windows Photo Viewer
    The thumbnails in Windpows Explorer look fine (they DO use the new ICC profile), when I double click a jpeg and open the image it DOES NOT use the new ICC profile. When I click the PLAY SLIDESHOW button (starting the slideshow) in the opened image in Windows Photo Viewer, the images DO use the new ICC profile.
    (2.) Internet Browsers
    All current internet browser (Firefox, IE, Safari and Chrome) DO use the new ICC profile and display the image correctly.
    (3.) Photoshop CS 5
    When I open the same image - that Windows Photo Viewer does not correctly displays (according to the new ICC profile) - in Photoshop CS5, I get the same image display that Windows Photo Viewer gives me (when not thumbnail or not in slideshow mode) - it appears to be the sRGB display.
    My color settings in PS CS5 are: North America General Purpose 2 > sRGB IEC 61966-2.1.
    When I go to View > Proof Setup > Monitor RGB I get the image display using the new ICC profile.
    Why does the image look different in PS than my calibrated monitor should output ?
    I was under the impression (please correct me if I am wrong), that the sole purpose for calibrating my monitor was to get a uniform display across (ICC aware) applications. Even when one applies different color spaces to a document in PS, I thought the output on my calibrated screen done by the graphic card should always be according to my calibration and the settings in the ICC profile being used.
    What Am I doing wrong or what am I misunderstanding ?
    Any help or input is appreciated !
    Thanks.
    - M

    Hello,
    A note on monitor calibration: calibrating your monitor will not guarentee that every application will display color correctly, it's more of a step along the pipeline, and for the preview part of a color workflow it's the last step.  Here's how color translation follows for an ICC workflow when previewing to a monitor:
    Image Color Numbers > Document Tag or Workspace Profile > Monitor Profile
    For non-color managed applications, if the original document is or isn't tagged with a color profile it will be translated directly to the monitor profile anyway.  This is the equivalent in Photoshop of selecting "Monitor" in soft proofing.  Selecting monitor in softproofing will bypass the tagged or workspace profile to translate colors directly through the monitor profile.
    For most automatic color managed applications (like Firefox), the image will be translated through the tagged profile and then sent through the monitor profile.  If the image is untagged or the profile is unrecognized, the colors get sent directly to the monitor profile.
    For Photoshop, a tagged document will have its profile respected and then sent to the monitor.  An untagged document will be assigned the workspace profile, which acts like a temporary document profile, and then gets sent to the monitor.  This is often why users will notice Photoshop behaves differently from other applications.  It's usually a case of the workspace coming into play.  By default the workspace profile is set to sRGB.  You can change this in Edit > Color Settings.
    The purpose of the workspace is originally for printing workflows, as a way of keeping consistant color translations when dealing with both tagged and untagged documents.  For web output workflows it can be useful for viewing everything through sRGB, which is typical of the average monitor output (not so with newer wide-gamut monitors, another source of confusion...) combined with the fact that originally most web browsers were not color managed.  Hence viewing everything through sRGB is pretty close to what most monitors see and what untagged/unmanaged docs will look like.
    Monitor calibration is useful only because it brings your monitor output to a "known state".  In traditional workflows the monitor was always a middle-man, a preview device which was useful for getting an idea of what the printed output would look like before you print it.  Since print colorspaces are often smaller than display spaces, it's feasible and useful to narrow down the monitor/display space and calibrate it to a known state, so that even if it doesn't totally match the print, you'll get used to its differences/limitations and they'll be consistent so long as the calibration is maintained.
    For web output, your final output is often another user's computer monitor, which can have any form of behavior (most standard monitors are pretty close to sRGB, or use sRGB as an operating system workspace (default monitor profile).  Wide gamuts behave differently, but I'm not sure if there's a particular ICC space that they closely match, or if different wide-gamuts are even that close to each other in their display color spaces.
    Hope this helps!

  • Quantity is different from sale order and delivery

    Hi,
    Gurus,
    Quantity is different from sale order and delivery.
    I identified the Material in the sales order, the item category for this material as BOM.
    I have also checked the bill of material display header overview. The Base Quantity maintained as 1000 EA3. The SUBITEM maintained in G in the unit field in bill of material display.
    Accordingly i have checked the same for material master's additionl data in Units of Measure tab, it is mentioned the basic unit as 1000 EA3 and alternative unit as 600 G.
    My client processed the order for 100 QTY. The QTY for the two sub item is 99.601 each in the sale order.
    My client Question is why in delivery the Material Qty is coming as 99.730 and the SUB ITEM is coming as 99.330 EACH.
    Note:- The material X is maintained in EA3 in Bill of material header overview. I do no how the sale unit came as G for the Material in sale order.
    The other two sub item is perfectly coming as G. Because it is maintained in G in the Bill of Material Display.
    Guide me GURUS.
    Thanks and Regards,
    ANAND

    Hello Rumar
    I guess you entered the text manually in the sales order. The Ship-to may not be having any text, but the Sold-to may be and it may be coming from sold to.
    In transaction VOTXN, check the access sequence for the text type id and see which one takes precedence - one from customer master or from the order by checking the order of accesses.

  • ALV GRID - Handling selected rows? Sorting in OUTTAB is different from ALV

    Dear Experts ,
    I have a transaction with ALV grid. I have defined several application specific functions to the ALV grid tool bar. My requirement is to handle the ALV tool bar functions only for the selected rows.
    Code snippet:
    DATA:
    LS_GRID_DS TYPE TYS_DS.
    TYPES: BEGIN OF TYS_DS.
    INCLUDE   TYPE TYS_ALVGRID.
    TYPES: STRUCNAME LIKE DD02L-TABNAME.
    TYPES: PRETAB    TYPE ZTAB_T,
           OUTTAB    TYPE ZTAB_T,
           OUTTAB_HIDDEN TYPE ZTAB_T,
           OUTTAB_SUM TYPE ZTAB_T,
           OUTTAB_ROLLBACK TYPE ZTAB_T,
           END OF TYS_DS.
      LOOP AT ls_grid_ds-marked_rows INTO ss_index_split
           WHERE rowtype IS INITIAL.
    ( Marked rows is correctly giving the row numbers of the highlighted rows)
    READ TABLE ls_grid_ds-outtab INTO ss_sel_rows_ds_split
                   INDEX ss_index_split-index.
    ISSUE : Sorting in ls_grid_ds-outtab internal table is different from ALV Grid display.
    Hence, though ls_grid_ds-marked_rows giving correct rows, I am not able to handle the my requirement correctly.
    Why sorting in gs_grid_ds-outtab is different from ALV display? How can they made in sync?
    Thank you in Advance.
    Sravan.
    Edited by: Raja Sravan on Jan 16, 2009 1:13 AM

    Hello Raja
    The OUTTAB is usually in sync with the display on the frontend grid control because it is a CHANGING parameter (of method SET_TABLE_FOR_FIRST_DISPLAY).
    Question: Do you "feed" ls_grid_ds-outtab to the parameter IT_OUTTAB of method SET_TABLE_FOR_FIRST_DISPLAY?
    If not then it is obvious why you get discrepancies.
    Regards
      Uwe

  • Report for PO with prices different from info record

    Hi All,
    Is there a std report in SAP that can view the PO with prices that varies from the Purch Info Rec price?
    User want to find out who put POs with prices different from prices already set in purch info recs.
    How this can be achieved?
    Thanks in advance!

    hi,
    There is no std report for the same....but you can see the PO price history from ME1P tcode....and price change in MMR can see from :
    CKMPCD Display Price Change Document
    CKMPCSEARCH Price Change Documents for Material...
    you can't see excatly who changed it ......its always better to avoid these situations by using Authorization for the same...
    Hope it helps....
    Regards
    Priyanka.P

  • Multi gesture for browsers different from safari

    Multi gesture for browsers different from safari, for example right to left scroll to previous page. How to set it like in Snow Leopard?

    THe only gesture to change tabs is to tap the tab in the address bar. You can go back a page in a website by holding one finger on the left side of the screen and swiping right. You can go back to a previous app by placing four fingers on the right side of the screen and swiping left.

  • I cannot get my messages/text messages to work om my Hi.  I am sending this thru my iPad.  Respond and let me know you got it.  Fun fun fun.  .  I did go and try to another Apple ID different from my iPhone but it still will not work.  Can anyone help me?

    I cannot get my messages/text messages to work om my Hi.  I am sending this thru my iPad.  Respond and let me know you got it.  Fun fun fun.  .  I did go and try to another Apple ID different from my iPhone but it still will not work.  Can anyone help me?

    chicx wrote:
    This is the third time of writing this on your Apple Support Communities!
    Not with your current user id.
    Far too much uneccesary information in your post, which only confuses things, a vast amount!
    Let's start with iTunes.
    Have you updated iTunes to 11.1.5, because the previous version did appear to have an issue about seeing iPods?
    With iTunes 11.1.5 installed, look in Edit/Preferences/Devices, (or use the ALT key, followed by the E key and then the F key) and make sure that the box named Prevent iPods, iPhones and iPads from syncing automatically does not have a tick in the box.
    Once you have doen those two things, check to see if the iPod is seen by iTunes.
    chicx wrote:
    By the way, what does IOS mean? (I thought IO stood for operating system, but am flummoxed by the S on the end.
    Really?
    OS stands for Operating System. (In computer speak, IO means Input/Output.)
    iOS originally stood for iPhone Operating System, but it now refers to the iPod Touch and iPhone. The iPod Classic, which you have listed in your profile as your iPod, does not use iOS.
    I assume that you have been listening to the Podcast in your iTunes on the computer as you cannot transfer it to your iPod. It's what I'd do.

  • Is there an email account that will allow me to use a different from address with a POP account

    Need to be able to delete emails (I have an Optonline address) from iphone and ipad during the day, while retaining them on Mac Book Pro to view and file into folders in the evening. 
    Seemed like I could have my optonline emails forwarded to a Gmail account and just set up the Mac's mail to use my optonline account, while the iPad and iPhone used my Gmail account.  That worked, except for one issue - when I sent mail from the iPad or iPhone it would use my Gmail address and then people who used "reply" would have their replies sent back to my Gmail account.  I wanted to continue to use my optonline address since I have had this address for many, many years.  I saw that Gmail allows you to "send using a different from address", however because optonline is a POP account, they do not support the settings in Gmail and therefore I cannot get my optonline address to be verified by Gmail, meaning my emails continued to be sent from my Gmail address on my iPhone.
    I even tried setting up the Gmail account manually (using "Other" in the ipone settings) and putting in a comma with my optonline address in the address field, but still no success.
    Next, thought I'd try Yahoo mail - same thing - only sends mail with my Yahoo account.
    Then looked into iCloud since I use that for syncing Contacts and Calendars on all 3 devices - same thing - I can only send email using the @me.com address.
    Does anyone know of any other mail account that will work with my POP Optonline email address?  After 10+ years with this email address, having to announce to my world that I am changing my address (either to Gmail, Yahoo, or the iCloud's @me.com address) is something I really don't want to do.
    However, leaving just my optonline account on all 3 devices means I am constantly deleting the same emails on 3 devices everyday, which is also just not an effective use of my time.
    Please help!

    Here's one possibility:
    http://www.ideaflight.com
    The only way to keep students in the presentation, though, would be to lock the iPads to that app via the Guided Access mode:
    http://support.apple.com/kb/HT5509
    Whether you can do this remotely through one of the various mobile device management (MDM) soutions I don't know.
    Regards.

  • How do I change my apply id?  the one on my ipod is different from my ipad and wont let me adjust

    My apple ID is different from my ipod to ipad. When I try to enter my password, it says it is not valid even though I have changed and apple confirmed it is reset. Seems like a continuous loop.

    I did that but when I go into Settings - iCloud - to turn off the Find my IPhone option, it still asks for the old email address password.  Any ideas?

  • HT5622 The Apple id that appears in my iCloud account is different from my Apple ID . I don't remember the password of the id that appears in iCloud, I want both to be the same, that is to say only one Apple ID , the one that I use for all the other appli

    The Apple ID that appears in my iCloud account is different from the one I use every time I' m requested by Apple. I forgot the password for the iCloud id. I need to know how to change the iCloud id and make them both the same.

    Is this a second hand iPhone?

  • How can I change my iTunes Account Name to something different from my Billing Information Name?

    I have an iTunes account using a relative's credit card. As a result, my iTunes Account Name is changed to her Name in the Billing Information.
    Can I change my iTunes Account name to something different from the Billing Information Name?

    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

  • I have an iCloud account that is different from my apple account.. How can I recover the password for that account??

    I have an iCloud account that is different from my apple account. How can I recover the forgotten password

    Hello Bgenie
    If you have forgotten the password to that Apple ID, then go to My Apple ID and you will see and option to reset your password. You will need to answer the security questions or if you have a rescue email address set up you can get it sent to that email to reset the password. Check out the article for more information.
    Apple ID: If you forget your password
    http://support.apple.com/kb/ht5787
    Regards,
    -Norm G.  

  • Print layout is different from the working view.

    I got two calendars in iCal, marked with red and green. I always make the green ones as the first one on everyday and the red ones as the second. However, when I printed the scheduled month, some red ones were in the upper positions and it looked different from my screen.
    How can I make all the green ones as the first event in the printed version.

    You can make objects visible only on the screen by selecting Object => Presence => Visible (Screen Only). You can do the same for printing by selecting the Visible (Print Only) option.
    Hope this helps,
    Mike

  • I have made a burn folder with photos exported from I-photo.  It now shows in information, that the date is created and modified is different from the original digitized date.  How can I get the original date to show in the info from Finder?

    I have made a burn folder with photos exported from I-photo.  It now shows in information, that the date  created and modified is different from the original digitized date.  How can I get the original date to show in the info from Finder?

    The Finder reports File information. The date and time of the photo are in the Photo's Exif metadata. The Finder has no awareness of this. All photos apps on any system do.
    Regards
    TD

Maybe you are looking for

  • How can I switch to syncing to another itunes library without losing my app data?

    I have a new imac and I built a new itunes library on that machine - I wanted a clean library. It's big. I want sync my iphone 5 to this new library but it's synced to my mbp13. I don't mind reloading my music, but I don't want to lose my app data. I

  • Problem sending pictures

    Can't send a picture while I'm texting on my IPhone.  I keep getting message not delivered.  Text messages work fine. Any suggestions?

  • Problems With Auto Update of Migration Workbench.

    I'm running v1.5.1 on MAC and am starting to look at migrating a MYSQL database to ORACLE. I wanted to make sure I had the latest updates so I used the "Check for Updates" function, which showed there were two updates available. Oracle Migration Work

  • Error Messages After Installing Leopard

    I did a clean Install of OS X Leopard on the new iMac I got yesterday (see specs below). Then, I used Setup Assistant to bring over my user folder, Applications, etc. I got the error message, "Errors and Warnings: - Some files from "Search Index 00D5

  • Program Logic for showin number of red lines on the o/p screen?

    Hi I have an output list wherein I am settin clours on the output screen based on certain conditions like if say 2 values in my final internal table doesn't match then I am settin the colour to red also green is set. My requirement is that I want to