Basic structure question (applet GUI)

I need to have an applet that allows you to draw on top of various sized images. The images are stored in a jar file, and the HTML tells me (via a parameter with a list of image sizes) the size of each of the images (Width x Height).
What you have is a variable sized area that holds an image, and buttons that allow for the drawing to take place.
How would you go about building (high level) such a beast?
Would you place the image inside a JPanel, load the image into the JPanel, and then resize the JPanel based on the HTML parameter with each new image loaded into it, or is there somehting else that needs to be done with an applet?
Obviously I've not done a lot of Applet coding, and I don't want to start down the wrong path!
Thanks.

If you are targeting Swing you can use those GUI elements, as they are light-weight. A JApplet is double-buffered as it is.
It seems you want to do your own light-weight component framework though.
Start with a JApplet, its paint, processMouseEvent, processMouseMotionEvent, look whether you need anything else.
Applet.getImage with Observer this, to get the width getWidth(Observer this) etcetera.
If you stay with Swing, use sun's tool to convert the HTML applet statement into HTML plug-in object for IE.

Similar Messages

  • Basic iPhoto questions:

    I have some Basic iPhoto questions before I start using the program:
    - does iPhoto apply any compression or change images in any way when they
    are imported?
    - after images are imported, can the original source folder of images be deleted off of the mac?
    - can Quicktime files exported from iPhoto be viewed on a Windows computer?
    - can iPhoto handle large resolution images that might be as large as 8-15mb each? does it display them quick? are there any known file size issues?
    Thanks!!!!

    kat.
    Is there a way to use iPhoto on a network so other users can read and possibly write to an iPhoto library on a networked mac?
    iPhoto is a consumer level photo organiser, not a server. It's possible to share photos but libraries are very difficult and fraught with the danger of database corruption. Some have reported success.
    Is it possible to password protect or secure certain images in the library so they can not be seen by anyone?
    No. The best I can suggest there is to create a second library and store it in a secure area like a protected dmg. But remember, you can only have one library open at a time.
    After photos are deleted from iPhoto, are there any remaining traces or cached files anywhere other than the trash
    If you delete photos from iPhoto and empty the iPhoto trash then the pics are removed from the Finder as well. They remain as findable as any other deleted file from that point, which is, very, if the searcher in knowledgeable.
    Regards
    TD

  • Object class deployment - Basic form question

    OK, I subclass calendar object from Oracle provided standard
    object class. What do I need to deploy to use this form now
    apart from calendar.pll and my fmx. What about the object class
    from which I sub-class. Do I need to compile and deploy that
    also? How will form resolve this on run time the parent object
    class as I really did not copy, just sub class and we do not
    deploy original class? Basic form question. Thanks.

    You can set the "help" property on the field (which gives you the little "information" icon link beside the field).
    You could also try adding another field of another class above or below:
    <Display class='InlineAlert'/>
    <Display class='ErrorMessage'/>
    <Display class='HtmlPage'/>
    ..etc
    -Rob

  • Industrial hierarchical structure on CRM GUI.

    I am trying to create an industrial hierarchical structure on CRM GUI on SPRO(Cross application componentes,SAP Business Partner,Business partner,Organizations,Mantain Industry System and Industries). I would like to know if exist any tool or if is possible to download massively my data,from an excel file,to CRM, considering the hierarchical structure.
    Thank you for your help.
    Francesco

    Hi Here i am also facing problem to identify the  link table  or field  between territory id and child territory ,  so if anybody could help us...
    Thanks.
    Vivek

  • Regarding basic idea of SAP GUI

    Hi friends,
                   I am a fresher in sap family joined before 6 months. I would like to know about basic knowledge of SAP GUI especially its definition. When i searched in Google i didnt get apt information regarding it. So please help me to know what is SAP GUI and its basic.

    Hi,
    GUI is Graphical User Interface for SAP.
    A simple information may give you about SAP GUI.
    http://en.wikipedia.org/wiki/SAPgui
    ****Reward points if Helpful*****
    Regards,
    Ganesh

  • Adding Date/Time Field + X Number of Days - Basic Calculation Question

    I am assuming this is a basic calculation question. New to Adobe LiveCycle Forms.
    I have a simple form containing a table. The table appears as such:
    Text
    Formatted as Date/Time Fields
    Header 3
    Monday
    user wil choose the beginning date (Date/Time) this is DateTimeField1
    Tuesday
    this should calculate DateTimeField1 + 1
    Wednesday
    this should calculate DateTimeField1 + 2
    Thursday
    this should calculate DateTimeField1 + 3
    Friday
    this should calculate DateTimeField1 + 4
    Saturday
    this should calculate DateTimeField1 + 5
    Sunday
    this should calculate DateTimeField1 + 6
    Calculations are performed after the date is chosen for Monday. My mind tells me the simple calculation of DateTimeField1 + 1 is not going to work (and in fact doesn't!) as it needs to change Monday to a number first. I saw on another thread the following:
    Num2Date(Date2Num(Date(DateTimeField1), "DD.MM.YYYY")+7, "DD.MM.YYYY")
    Thought this was going to get me close. No cigars though!
    Any quick help is greatly appreciated. And since I am new to this, details about what needs to be changed would be great too!
    Thanks

    Here an addition for you date field.
    This FormCalc script in the exit:Event will check it the selected date is on a monday.
    If not it will go the days back until the last monday.
    var Selection = Date2Num($.formattedValue, DateFmt(2))
    var WeekDay = Num2Date(Selection, "E")
    var NewDate
    if (WeekDay eq 1) then
              NewDate = Selection - 6
    elseif (WeekDay eq 3) then
              NewDate = Selection - 1
    elseif (WeekDay eq 4) then
              NewDate = Selection - 2
    elseif (WeekDay eq 5) then
              NewDate = Selection - 3
    elseif (WeekDay eq 6) then
              NewDate = Selection - 4
    elseif (WeekDay eq 7) then
              NewDate = Selection - 5
    else
              NewDate = Selection
    endif
    $ = Num2Date(NewDate, "EEE DD.MM.YYYY")
    Hope this helps, too.

  • Where to create an applets GUI?

    Hi, i'm interested in some comments on where to create an applets GUI.
    Recently, i had to use JBuilder 7 to create an applet, and the wizard creates a jbInit() method to create the GUI and calls this method inside the applets constructor.
    Up to now, i used to build the applets GUI inside the applets init() method (as practiced by the Java Tutorial).
    Any comments on these two different approaches?
    Thanks in advance.
    Markus

    Just for the files: after reading the following paragraph in the Java Tutorial, i have decided to go with the init method:
    'The init method is useful for one-time initialization that doesn't take very long. In general, the init method should contain the code that you would normally put into a constructor. The reason applets shouldn't usually have constructors is that an applet isn't guaranteed to have a full environment until its init method is called. For example, the Applet image loading methods simply don't work inside of a applet constructor. The init method, on the other hand, is a great place to call the image loading methods, since the methods return quickly.' (Trail: Writing Applets, Lesson: Overview of Applets, Methods for Milestones)
    HTH, Markus

  • Basic Exporting Question

    My main question is a very basic exporting question, but here is a super-condensed explanation of my big-picture goal for context:
    Large (~450 MB) aiff on CD --> trim w/ Quicktime --> small (~16 MB) MP3 in iTunes
    I would like to take an audio file (aiff) that is approximately 450 MB and export it from Quicktime and in doing so, reduce the file size and convert it to MP3. When I simply try to export it, it doesn't ask me about what size I want, nor does it give the option of MP3 formatting.
    I have figured out how to reach my goal, but it's a mess. After I make my trims in QT, I have to:
    1. select "share" instead of "export".
    2. It asks me what size I want and I select small.
    3. The file is then exported as a Quicktime movie into Mail and the size is reduced from 450 MB to about 20 MB.
    4. I then have to "right-click" on the attachment in the email that is created,
    5. save the attachment,
    6. discard the email,
    7. import the file into iTunes, and
    8. create an MP3 in iTunes to finally arrive at my goal.
    This seems like a ridiculously convoluted process to change a large aiff to a small MP3 and put it in iTunes. Any suggestions?

    Thanks. I guess the basic answer to my question is that it can't be done in one or two fell swoops. The problem is that it starts on a burned disc, and I need to make edits to it before it ends up in iTunes (to be eventually used in iWeb). I was hoping to avoid juggling back and forth between iTunes and QT. I either would have to send it back to QT to do the edits after -->iTunes-->mp3, or import the large file from the CD to QT, make the edits, save changes, import large file to iTunes, convert to mp3.

  • Few basic SRM questions .......

    I recently completed the SRM training from SAP and I have few basic questions and need help. Full points will be rewarded.
    These are my questions and it is based on SRM 5.0 Classic Scenario with R/3 backend
    1. Invoice  & confirmation transferred to R/3 via  ALE ? .  All other documents are transferred to R/3 via RFC?
    2. Based on the configuration, if the material is available in the backend then reservation will be created. Other wise PO will be created.  For text items, PR will be created.
         a. Who (purchaser) will process the PR in R/3 and how it is processed?.
         b. Who (purchaser?) will process the reservation in R/3 and how it is
             processed?. Assume no sourcing is setup in this case and No MRP run.
    3. How the vendor is linked to the Material or product category in SRM?. During the vendor replication from R/3, vendor and material/prod category link is automatically maintained?
    4. How the vendor is linked to a specific purchasing org/group? Is it based on the prod category assigned in the org structure for each purchasing org or purchasing group?
    5. How to do delta prod category replication?
    6. How to do Delta Material Replication?.
    7. Contracts and vendor list:-
        In our SAP training we created these from the browser. But in the actual
        implementation how do we create this?. Is it always from the browser?
    8. Direct Material and Plan driven Procurement.
       Can we use catalog items as direct material?. Just for example - > What
       about ‘Car Batteries’ that  is directly used in production and has the inventory
       also. But we are using electronic catalog for procuring this item. Is it possible to
       order this as direct material?
    9. How to replicate Plant. How to use DNL_PLNT?. Is BBP_LOCATIONS_GET_ALL will replicate all the PLANT's and its locations from the R/3 backend?
    10. In the HR system, which transaction we can view the org structure?

    Hi
    Answers to your questions ->
    1. http://help.sap.com/saphelp_srm50/helpdata/en/e9/d0fc3729b5db48e10000009b38f842/frameset.htm
    http://help.sap.com/saphelp_srm50/helpdata/en/74/ec7b3c91c1eb1ee10000000a114084/frameset.htm
    http://help.sap.com/saphelp_srm50/helpdata/en/55/d77c3c3fd53228e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_srm50/helpdata/en/77/e97b3c91c1eb1ee10000000a114084/frameset.htm
    2.  Provided the necessary role is given to the Purchaser (Buyer) in the System.
    a) Yes
    b) Yes
    3. http://help.sap.com/saphelp_srm50/helpdata/en/e5/f5e938b4ece075e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_srm50/helpdata/en/70/00c73a584611d6b21700508b5d5211/frameset.htm
    4. http://help.sap.com/saphelp_srm50/helpdata/en/2c/867d3ca2156c6ae10000000a114084/frameset.htm
    The vendor ORG has to be seperately created through trasaction PPOCV_BBP before replicating the Vendors from the R/3 System.
    http://help.sap.com/saphelp_srm50/helpdata/en/70/00c73a584611d6b21700508b5d5211/frameset.htm
    5. http://help.sap.com/saphelp_srm50/helpdata/en/42/d3b671ba67136fe10000000a1553f7/frameset.htm
    6.  http://help.sap.com/saphelp_srm50/helpdata/en/29/d586398dcfd74fe10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_srm50/helpdata/en/05/9b8139437eac2ae10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_srm50/helpdata/en/f5/b4bcdac7c40c4dba53e3695d18236c/frameset.htm
    7. Yes, from Browser it's quite easy and is quite user-friendly.
    8.
    http://help.sap.com/saphelp_srm50/helpdata/en/d3/4b9c3b122efc6ee10000000a114084/frameset.htm
    http://help.sap.com/saphelp_srm50/helpdata/en/18/db183d30805c59e10000000a114084/frameset.htm
    9.
    You can use the following three routines to download locations from the backend system and store them as business partners in SAP Enterprise Buyer.
    BBP_LOCATIONS_GET_ALL
    To get all the location numbers from each backend system that is connected
    BBP_LOCATIONS_GET_FROM_SYSTEM
    To get all the location numbers from one particular backend system
    BBP_LOCATIONS_GET_SELECTED
    To get selected locations
    Previously, locations were not given business partner numbers in SAP Enterprise Buyer. If you are configuring an upgrade, you can use routines BBP_LOCATIONS_GET_FROM_SYSTEM and BBP_LOCATIONS_GET_SELECTED to check that the following conversions have been made:
    ·        Conversion of user favorites
    ·        Conversion of user attributes
    ·        Conversion of old documents
    Routine BBP_LOCATIONS_GET_ALL checks these automatically.
    Once you have run the routines, the location data is available in the SAP Enterprise Buyer system. Table BBP_LOCMAP contains the mapping information (in other words, which business partner number corresponds to which location in which backend system).
    For more information, see SAP Note 563180 Locations for EBP 4.0 – plant replication
    http://help.sap.com/saphelp_srm50/helpdata/en/62/fb7d3cb7f58910e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_srm50/helpdata/en/77/e97b3c91c1eb1ee10000000a114084/frameset.htm
    10. PPOCA_BBP(Create) / PPOMA_BBP(Change) / PPOSA_BBP(Display).
    Regards
    - Atul

  • Basic swing question

    I just started looking at swing yesterday because I want to provide a GUI to replace a command line utility we use. I've basically finished it but have a quick question about form - I will get some literature later but would like to get a feel from the people here. If you have a JFrame with a few JPanels each which contain some other components, what is the best practice for variable declaration? Should I just declare the variables locally or should I make them instance variables? The reason I ask is that I have a button that submits a message but that message is dependant on check boxes, etc. from from the frame. If I declare them at the method level I then have to start passing them around whereas if I declare them as instance variables I can access them very easily BUT this may not be good form.
    For example:
    my class is SendMessageToo so in the main method I have a line like:
    final SendMessageToo smt = new SendMessageToo();
    now all the instance variables that I have can be accessed my the methods simply using smt.methodOne(), etc. Does that seem OK or is it just pure crap? :-)

    Thanks, that was something that crossed my mind before I just made eveything an instance variable. It was during that process that I thought, do these all need to be instance variables? Then I thought, SHOULD they all be instance variables. At that point my brain imploded so I came here. :)

  • 4 basic java questions..

    ok so I already learned Java last year (in grade 11), but my teacher didn't really teach anything, we learnt everything by ourselves from the API... so theres a lot of things I actually don't understand, but for now I want to ask 4 basic questions:
    1. What does static mean?
    2. Why would u "final" a constant variable? ie. If you have a variable called SIZE which is set to 5, so if u want it to be a constant, just never change its value. But what does the keyword final do to it?
    3. What's super? I see it sometimes, and my teacher showed us in the applet exampls to use super.paint(g) or somethign like that for the paint method, but I never use that because I noticed it works fine without it..
    4. Whats a question mark? I saw a game that was made in java and it had a lot of places where it had a question mark , which was part of the syntax. For example,
    int j1 = i != 0 ? i - 1 : 199;
    OR
    JUMPVEL = (fSuperSlime) ? 65 : 31;
    I really don't understand these lines...
    feel free to answer any of these questions...

    wow cool...thanks.. that question mark thing is nice
    saves a few lines..
    now, about super, so u mean u can access the parent
    class's variables?Variables, methods, constructors, if the access level is such that it's allowed.
    This will be covered in any tutorial or text though.
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoratative than this.

  • MySQL Database Structure Question

    This is probably going to seem a little odd, but I need some outside opinions.  I'm using Dreamweaver CS5 to build a business website.  When all is said and done, it's going to have around 20,000 items (not anytime soon, but it'll get there).  I'm using a dynamic data set up to load the inventory because I'm way too lazy to build that many pages and links one at a time.
    The corporate chain has two sections, lighting, and electrical supply.  I want the database to hold the product ID(of course), name, description, image(this is part of where the question comes in), price, sale price(discounts not our cost), an enum field for whether or not the item is discontinued(for our own records), size / weight for shipping reasons, and if reality is permitting, a field for color selection of the products.
    My original idea was to have two tables, one for lighting, one for electrical.  Somebody pointed out to me that this could fail because they pointed out that some of the items might have multiple images, which is true.  Some of the items (like some of the fans we sell) have different colors but still cost the same.  They suggested I set the images up in a seperate table and use a foreign key. but that changes my entire structure.
    Does anyone mind offering ideas on how I might set that up to avoid data redundancy and other problems that might pop up due to repeat listings?  I've got the images all with unique names (in the case of the same product in different colors, I added a color code like pb for polished brass, etc.)  That person had an excellent point on multiple tables, so now I'm wondering about a better and more reliable structure.

    I'm ok with PHP, and usually pretty good with databases.  Right now I've got enough sample stuff to build a smaller scale prototype with about 200 products, from both lighting and electric.  Believe me, I haven't really done much more than start with the layout, because the many to many relationships just didn't occur to me.  Pretty much going solo on this project with occasional advice from one co-worker who's good at his job but extremely busy, so I think I just got a little to close to it and overlooked some clear and obvious problems.  As far as requirements, I'm using a 3 column div tag layout, the left column being the nav bar with the product categories.  When they click one of those, it should display that category (image, name, price) with the clickable name and thumbnail image in the middle, and from there they click the product they want to see and it'll display the full size image and full description on the right column.
    Set requirements...wish I had a clear list, but the bosses are pretty much illiterate in this area of computers, so I'm on my own with that.  That's all I'm hoping to get out of the database is that three column layout.  I figure I'll make a changeable nav bar later so customers can switch from one store to the other and the nav bar goes from there.
    We're hoping to get the database to have the fields I mentioned for now (at least for initial testing) and maybe add an inventory tracking function so we know how many we have throughout the chain.  We're not worried about that part now, just getting them up and selling cuz our current inventory system works just fine.  How would 10 or more tables be better?  Just breaking down the amount of products to be searched at a time, or is that how detailed you think it should be built?  Don't worry, I wasn't hanging everything on a two table set up, I knew there would be room for much improvement.
    Current basic layout:
    Lighting / Electric Tables          Image table:  ID (either the product ID without the color code or maybe the document path), category(lighting / electric),                                                                   subcategory (fan, lamp, etc)
    id
    class
    category
    description
    price
    sale price
    discontinued
    size
    weight
    That's what I've got so far, sorry for the weird way that list pasted....

  • Automated XML - Placeholder Structure Question

    I'm testing XML import for a series of publications that need use automated layouts...having never attemped this. But I am confounded regarding the placeholder structure and how it should mirror the XML structure and am banging my head against a wall.
    The basics of my pub are: I have profiles for every school in a district. Profiles are grouped by type of school (elem, middle, high). So my test XML example is structured like this:
    <elementarySchools>
    <schoolData>
         <name>
         <address>
         <city>
         <state>
         etcetera...the rest of the profile is demographics, testing scores and other stuff.
    </schoolData>
    </elementarySchools>
    Each school has about 43 fields.
    I setup a document (not a tempate) with the 43 frames and taggge them to correspond to those in the XML
    Each time I attempt the import to auto-populate, the XML comes in but no data displays in the frames.
    QUESTION 1: Do the 43 frames need to be within a parent frame tagged as schoolData? If I drag a "schoolData" node in, it contains all of the proper data. But the objective is to auto-populate frames so they can be moved and styled as needed.
    QUESTION: 2: If I ultimately need data to be displayed in a table-like layout, should I be trying to build tagge table layout?
    I've read some tutorials on Adobe and I've watched a couple of Lynda vids, but I seems to be missing something important here. Any pointing in the right direction is appreciated.

    Circling back on this in hopes someone can help get my ship pointed in a decent direction.
    Reading up on tables via XML, as Mike mentioned, not the the greatest method and required building every table in the XML file. That's not really any more efficient for me.
    However, since my "table" layout isn't that complex, I could create it using text frames that look like tables when styled correctly. This bring me back to my original issue: How do I get the XML to auto-populate tagged data frames and clone?
    As sample layout would be something like this per page. Each "data" element would be a tagged frame, as well as School Name/address/phone/type:
    --------------------beginning of school profile <schoolData> xml tag-----------------------
    School name
    school address • phone • type
    Heading                                    Heading                  Heading
    title | data                                   data                         data
    title | data   
    title | data   
    title | data   
    Heading                                 Heading
    title | data                                title | data
    title | data                                title | data
    title | data                                title | data
    title | data                                title | data
    ------------------ end of school  profile </schoolData> xml tag--------------------------------
    --------------------beginning of school profile <schoolData> xml tag-----------------------
    School name
    school address • phone • type
    Heading                                    Heading                  Heading
    title | data                                   data                         data
    title | data   
    title | data   
    title | data   
    Heading                                 Heading
    title | data                                title | data
    title | data                                title | data
    title | data                                title | data
    title | data                                title | data
    ------------------ end of school  profile </schoolData> xml tag--------------------------------
    >> Repeat through all profiles
    I can create my layout using frames. All headings and titles can be built into a master page or template. I could set up individual frames for each data point. But I cannot for the life of me get the XML data to auto populate those tagged frames. It still seems to have something to do with the container nodes...that more than one text frame can be nested in another or tables have to be created in the XML...both of which kill the efficiency of using XML.

  • Basic JDBC Question

    Okay, I think this isn't supposed to be in this forum (Seeing as how there's a JDBC forum and all..), but this is so basic and I'm kicking myself over it I thought I'd put it in here. Anyways:
    I just installed mysql-connector-java-2.0.14, or at least I think I did. I keep getting the "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" error. I read a lot of the forum hits I got for the error, but none of them helped me out...
    My JDK (I'm using 1.3.1_06 for compatibility reasons) is installed to /usr/java/jdk
    I'm compiling an applet on one machine, but hosting it off another. The applet must then be viewed by the compiling machine, the hosting machine, and any other machines (which I do not have access to).
    My question is this: What the hell am I doing wrong. :) Am I not understanding applets right? Does the client viewing it have to have the mysql driver installed? Does the server need it? I would assume only the compiling computer would...
    And if I only need it on the compiling machine, what am I doing wrong? My environmental variables are set as shown, I'm compiling with the shown command, and the code snippets are from my stuff. Parts in bold are what I feel is relevent (in the paths). God I feel like an idiot...
    Thanks in advance, and sorry to waste your time...
    echo $PATH
    /bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/home/jcourts/bin:/usr/java/jdk/bin:/usr/java/jdk/jre/lib/ext:/usr/java/jdk/jre/lib/ext/mysql-connector-java-2.0.14-bin.jar
    echo $CLASSPATH
    /usr/java/jdk/jre/lib/ext:/usr/java/jdk/jre/lib/ext/mysql-connector-java-2.0.14-bin.jar
    echo $JAVA_HOME
    /usr/java/jdk
    /usr/java/jdk/bin/javac -g -deprecation *.java
    import java.sql.*;
    -and-
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://<<host_is_here>>/<<db_name>>?user=<<username>>");

    Hvae program to test the ODBC or JDBC Bridge and driver, so that you know you've set it up right. I gave up on applets ages ago for this sort of thing, though I do know you have to install a seperate driver for applets, perhaps someone could come in on this and guide you more
    This will teat your driver and set-up, so compile and run this code;-
    import java.sql.*;
    import java.util.*;
    public class MyConnection
         Connection con;
         MyConnection()
              try
    // ******************************Connected To Jdbc-Odbc Type - 1 Driver
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    //               con = DriverManager.getConnection("Jdbc:Odbc:dsnname","userid","password");
                   con = DriverManager.getConnection("jdbc:odbc:Driver={SQL Server};Server=servername;Database=pubs","userid","password");
    // ******************************Connected To Ms-Access JDBC ODBC Driver .
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con = DriverManager.getConnection("Jdbc:Odbc:dsnname","","");
    //               con = DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=G:/admin.mdb","","");
    // ******************************Connected To Ms-Access Type-3 Driver.
         /*          Class.forName ("acs.jdbc.Driver");
                   String url = "jdbc:atinav:servername:5000:C:\\admin.mdb";
                   String username="Admin";
                   String password="";
                   Connection con = DriverManager.getConnection(url,username,password);
    // ******************************Connected To Microsoft SQL.
                   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                   con = DriverManager.getConnection("jdbc:microsoft:sqlserver://servername:1433","userid","password");
    // ******************************Connected To Merant.
                   Class.forName("com.merant.datadirect.jdbc.sqlserver.SQLServerDriver");
                   con = DriverManager.getConnection("jdbc:merant:sqlserver://servername:1433;User=userid;Password=password");
    // ******************************Connected To Atinav SqlServer.
                   Class.forName ("net.avenir.jdbc2.Driver");
                   con= DriverManager.getConnection("jdbc: AvenirDriver://servername:1433/pubs","userid","password");
    // ******************************Connected To J-Turbo.
    /*               String server="servername";
                   String database="pubs";
                   String user="userid";
                   String password="password";
                   Class.forName("com.ashna.jturbo.driver.Driver");
                   con= DriverManager.getConnection("jdbc:JTurbo://"+server+"/"+database,user,password);
    /*// ******************************Connected To jk Jdbc Driver.
                   String url= "jdbc:jk:server@pubs:1433";
                   Properties prop = new Properties();
                   prop.put("user","userid");//Set the user name
                   prop.put("password","password");//Set the password
                   Class.forName ("com.jk.jdbc.Driver").newInstance();
                   con = DriverManager.getConnection (url, prop);*/
    // ******************************Connected To jNetDirect Type - 4 Driver
    /*               String sConnect = "jdbc:JSQLConnect://127.0.0.1/database=pubs&user=userid&password=password";
                   Class.forName ("com.jnetdirect.jsql.JSQLDriver").newInstance();     
                   Connection con= DriverManager.getConnection(sConnect);
    // ******************************Connected To AvenirDriver Type - 4 Driver
    //               String url= "jdbc: AvenirDriver: //servername:1433/pubs";
    //               java.util.Properties prop = new java.util.Properties ();
    //               prop.put("user","userid");
    //               prop.put("password","password");
    /*               Class.forName ("net.avenir.jdbc2.Driver");     
                   System.out.println(" Connected To AvenirDriver Type - 4 Driver");
                   con= DriverManager.getConnection("jdbc: AvenirDriver://servername:1433/pubs","userid","password");
    // ******************************Connected To iNet Sprinta2000 Type - 4 Driver
         /*          String url="jdbc:inetdae7:servername:1433";
                   String login="userid";
                   String password="password";
                   Class.forName("com.inet.tds.TdsDriver");
                   System.out.println(" Connected To iNet Sprinta2000 Type - 4 Driver");
                   con=DriverManager.getConnection(url,login,password);
    // ******************************Connected To iNet Opta2000 Type - 4 Driver
    /*               String url="jdbc:inetdae7:servername:1433";
                   String login="sagar";
                   String password="sagar";
                   Class.forName("com.inet.tds.TdsDriver").newInstance();
                   System.out.println(" Connected To iNet Opta2000 Type - 4 Driver");
                   con=DriverManager.getConnection(url,login,password);
                   DatabaseMetaData md = con.getMetaData();
                   System.out.println("Driver Name            " + md.getDriverName());
                   System.out.println("Driver Version         " + md.getDriverVersion());
                   System.out.println("Database URL is        " + md.getURL());
                   System.out.println("Database UserName is   " + md.getUserName());
                   System.out.println("Connection Name        " + md.getConnection());
                   System.out.println("Database Name          " + md.getDatabaseProductName());
                   System.out.println("Database Version       " + md.getDatabaseProductVersion());
                   System.out.println("Database ReadOnly Type " + md.isReadOnly());
                   System.out.println("MaxColumnNameLength    " + md.getMaxColumnNameLength());
                   System.out.println("MaxConnections         " + md.getMaxConnections());
                   System.out.println("");
              catch(ClassNotFoundException cnfe)
                   System.out.println(cnfe.getException());
                   System.out.println("The Specified Driver Does not Exist....");
              catch(SQLException sqle)
                   if(sqle.getErrorCode() == 0)
                        System.out.println("No Suitable Driver Found..");
                   else if(sqle.getErrorCode() == 1017)
                        System.out.println("Wrong UserName Or Password..");
                   else if(sqle.getErrorCode() == 1034)
                        System.out.println("Database not Started..");
                        System.out.println(sqle.getErrorCode());
                        System.out.println(sqle.getSQLState());
                        System.out.println(sqle);
         public static void main (String args[])
              new MyConnection();
    }

  • Basic Ant Question

    Any Ant experts out there? This is such a basic question and I'm surprised it's not attacked point-blank in the Ant docs. I must be missing something.
    I'm trying to use ant to build a makefile that can be used on both Unix and Windows. Basically the only difference between the two environments will be the name of the company root directory (designated by the environment variable CAEROOT which is defined under both OS's).
    How can I access that environment variable with ant??? The obvious attempt shown below doesn't work because I guess Ant thinks it's a property.
    <code>
    <project name="XMLDBBridge" default="compile" basedir=".">
    <!-- set global properties for this build -->
    <property name="src" value="src"/>
    <property name="build" value="classes"/>
    <property name="caeroot" value="${CAEROOT}/"/>
    <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    </target>
    <target name="compile" depends="init">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" classpath="${caeroot}/JLib/OracleJDBC/;
    ${caeroot}/JLib/OracleXDK/lib/xsu12.jar"/>
    </target>
    <target name="clean">
    <!-- Delete the ${build} directory trees -->
    <delete dir="${build}"/>
    </target>
    </project>
    </code>

    In case anyone else ever has this same problem.
    I finally figured out how to get environment variables working in ant. It's quite nice but doesn't really figure anywhere in the docs even though I feel its one of the key usages for ant.
    <code>
    <project name="XMLDBBridge" default="compile" basedir=".">
    <!-- set global properties for this build -->
    <property name="src" value="src"/>
    <property name="build" value="classes"/>
    <property environment="envvar"/>
    <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    </target>
    <target name="compile" depends="init">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" classpath="${envvar.CAEROOT}/JLib/OracleJDBC/;
    ${envvar.CAEROOT}/JLib/OracleXDK/lib/xsu12.jar"/>
    </target>
    <target name="clean">
    <!-- Delete the ${build} directory trees -->
    <delete dir="${build}"/>
    </target>
    </project>
    </code>

Maybe you are looking for