Remote Connect?

Hello Everyone - I’m not sure if I’m posting this in the correct area - but I was wondering how I would go about remotely connecting to a Tamino database. I’m on a mac running OS X with Tomcat as my webserver, and the Tamino Database is on a PC running Red Hat Linux with Apache as it’s webserver, if that helps at all. Any help is greatly appreciated. TJ

As Tamino supports access via HTTP you just need to provide the correct URL to reference it. So on your mac you would access: [url]http://linuxbox/tamino/db/collection[/url] Not sure what API support there is for the mac though. If you are able to run the Sun JDK then the Java API might possibly work. At the very worst you could program access via the HTTP interface.

The Tamino API for Java should work just fine on your Mac.

Mark & Curtis - Thanks for the help! TJ

Hello again everyone, I have another wonderful question for you! What changes (if any) would I have to make to Tamino to give myself permisson to connect to it? In addition, do you happen to know of a simple way to test to see if I am infact able to interact with the database (A Java-ish way preferably)? Sorry for the ultra-simple questions, but I’m sort of stranded on an Tamino island and am in need of a life preserver!! Thanks again! TJ

Hi TJ, Permissions: - Just to query the database you should not need any special permissions. - If Tamino Security is being used then you need to have your user-id added to Tamino Security. - If you are talking about the being able to perform database (DBA) functions such as starting and stopping the database then you need to have your user-id added to the System Management Hub (SMH) as an administrator. Test db access: The easiest command is to ping the database from your browser’s Address (command) line. It command would look like: http://the-Tamino-host/tamino/the-db-name/?_diagnose=ping To ping mydb on my pc the command is: http://localhost/tamino/mydb?_diagnose=ping If the database is up it will return “Server is alive” Java example: (I hope this is not to verbose) /* * Copyright (c) 2003 SOFTWARE AG, ALL Rights Reserved. / / || Example using the Tamino API for Java || || The following tasks are performed: || || - Check the Server Status and Print the System Information || / import com.softwareag.tamino.db.API.accessor.TAccessLocation; import com.softwareag.tamino.db.API.accessor.TAccessorException; import com.softwareag.tamino.db.API.accessor.TSystemAccessor; import com.softwareag.tamino.db.API.common.TException; import com.softwareag.tamino.db.API.connection.TConnection; import com.softwareag.tamino.db.API.connection.TConnectionFactory; import com.softwareag.tamino.db.API.common.TAccessFailureMessage; import com.softwareag.tamino.db.API.connection.TConnectionException; import java.io.; import java.lang.; import java.util.; /** ** Check the database status, i.e., is it running and accessable ** ** ** ** / //java CheckDBstatus http://pcdummy/tamino/mydb public class CheckDBstatus { protected static boolean checkServerAndPrintSystemInformation(TConnection connection, String DATABASE_URL ) throws TAccessorException { // Obtain the TSystemAccesor TSystemAccessor systemaccessor = connection.newSystemAccessor(); if (!systemaccessor.isServerAlive()) { return false; } else { System.out.println( “------------------------------\nServer is alive” ); System.out.println( "The Tamino server hosting " + DATABASE_URL + " is version " + systemaccessor.getServerVersion() ); return true; } } / ** parseArgs ** ** ** @param args ** ** @return ** **/ private static String parseArgs( String args){ if (args.length >= 1) return args; else { System.out.println(“\n>> Tamino Demo Programs << \n” + “Copyright (c) 2000 SOFTWARE AG, ALL Rights Reserved. \n\n” + “Usage: java CheckDBstatus database-url\n” + " e.g. java CheckDBstatus http://pcmypc/tamino/mydb\n" ); System.exit(0); return null; } // end else } // end parseArgs() public static void main (String args) throws Exception { parseArgs(args); String sargs= parseArgs(args); // URL of the Tamino database String DATABASE_URL = new String( sargs[0]); // Establish the connection to Tamino TConnection connection = TConnectionFactory.getInstance().newConnection( DATABASE_URL ); // Check if the connection is available and print out some system information if ( !checkServerAndPrintSystemInformation( connection, DATABASE_URL ) ) return ; } // end main } // end CheckDBstatus

Rob - Thanks for the help - when I pinged the database I got a response, so that worked out. But when I try to compile the Java example that you last posted, I keep getting errors because I don’t think that I have all of the Java API files. I downloaded the ones that were available from SoftwareAG, but I still think I’m missing: TaminoAPI4J.jar log4j-core.jar xerces.jar jdom.jar Any hints on where I can find those (and their end location, if they need to be in a different directory than ‘classpath’)? Thanks a lot! TJ

TJ, On the system where Tamino was installed you should be able to find all these jar files. The default location on RedHat is: /usr/SAG/ino/v4211/SDK/TaminoAPI4J/lib The Tamino API for Java is also available under “Downloads” here in the Tamino Developer Community. But I believe you will need access to a PC to run the install. So getting copies of the jar files from the RedHat box may be easier. Modify your CLASSPATH pointing to each of the jar files and you should be set. The location of the jar files is not important just as long as you have them defined in you CLASSPATH. While your getting copies of the jar files, I recommend copying the Documentation and examples from the TaminoAPI4J directory also. Good information contained in both. Rob

Rob - Excellent! I found the files and put them in C:\jars\ for simplicity. I edited my classpath to this (but with no spaces): set CLASSPATH=.;C:\jakarta-tomcat-5.5.9\common\lib\servlet-API.jar; C:\jakarta-tomcat-5.5.9\common\lib\jsp-API.jar; C:\Servlets+JSP;…;…..; C:\jakarta-struts-1.2.4\lib\struts.jar; C:\jars\jdom.jar; C:\jars\TaminoAPI4J.jar; C:\jars\log4j-core.jar; C:\jars\xerces.jar But I still seem to get the same errors. Here’s a snippit of some of the errors that I’m getting: C:\Servlets+JSP\testme.java:14: package com.softwareag.tamino.db.API.accessor does not exist import com.softwareag.tamino.db.API.accessor.TAccessLocation; ^ C:\Servlets+JSP\testme.java:15: package com.softwareag.tamino.db.API.accessor does not exist import com.softwareag.tamino.db.API.accessor.TAccessorException; ^ Any clues on what I’m doing wrong? Thanks again! (P.S. I’m now trying to accomplish this connect from a Windows computer, as I’m more familiar with its workings than OSX - I just wanted to let you know in case that could be the could be a source of problems) TJ

Hi TJ, Here is my classpath info in regards to the Tamino API for Java: C:\Program Files\Software AG\Tamino\Tamino 4.2.1.1\SDK\TaminoAPI4J\lib\jdom.jar; C:\Program Files\Software AG\Tamino\Tamino 4.2.1.1\SDK\TaminoAPI4J\lib\log4j.jar; C:\Program Files\Software AG\Tamino\Tamino 4.2.1.1\SDK\TaminoAPI4J\lib\TaminoAPI4j.jar; C:\Program Files\Software AG\Tamino\Tamino 4.2.1.1\SDK\TaminoAPI4J\lib\TaminoJCA.jar; C:\Program Files\Software AG\Tamino\Tamino 4.2.1.1\SDK\TaminoAPI4J\lib\xercesImpl.jar; C:\Program Files\Software AG\Tamino\Tamino 4.2.1.1\SDK\TaminoAPI4J\lib\xmlParserAPIs.jar I don’t have the xerces.jar file you note. Instead I see an xercesImpl.jar. That aside (should have nothing to with the error your are seeing), your classpath looks correct. On my RedHat system (since that is where your API came from) I used the command ‘jar tf TaminoAPI4J.jar’ to list it and confirm the the package (directory) com.softwareag.tamino.db.API.accessor does exist, which it does. I’m note sure how you are running the java program on your system but I normally do this from the dos/command prompt. After making any CLASSPATH modifications I need to close the old window and open a new dos window prior to (re)running the java program so that it picks up the new CLASSPATH (changes). Are you using an application that requires it to be shutdown and restated to pick up the CLASSPATH modifications you made? Rob

Rob - Thanks again for the help! I think I just needed to restart my computer for the CLASSPATH info to take effect (I was setting it in Control Panel > System > Enviro Variables). I now only have 2 errors left (down from 14 on my last post). These are the errors I’m currently getting: C:\Servlets+JSP\testme.java:34: class CheckDBstatus is public, should be declared in a file named CheckDBstatus.java public class CheckDBstatus { ^ C:\Servlets+JSP\testme.java:20: cannot resolve symbol symbol : class TAccessFailureMessage location: package common import com.softwareag.tamino.db.API.common.TAccessFailureMessage; ^ Any idea on what I’m messing up now? Sorry to swamp you with these questions - but I think I may actually be making progress now! TJ Edit: I also found that ‘xerces.jar’ is an older version of the API, which is now contained in ‘xmlParserAPIs.jar’ and ‘xercesImpl.jar’ in the newer versions of Tamino.

Hi TJ, The first error is due to the class name defined in the code not matching the java program name. Solution: Change either the program name or the class “CheckDBstatus” name so that they match. The second error I’m not sure about. The class TAccessFailureMessage is contained in the Tamino API at com.softwareag.tamino.db.API.common. Just to make sure, check the access premissions for the jar files and confirm that the permissions for the file allow your user-id to “execute” it. Correct the file name/class name. Recompile and re-run. Let me know if this resolves the errors. Rob

Rob - Humm . . well I think I may have fixed it correctly, but I’m not sure. I uncommented the line of code where it seemed to define the CheckDBstatus, and pointed it at the correct location, as you can see below: java CheckDBstatus http://xxx/tamino/Hermes public class CheckDBstatus { But now I am getting this error: C:\Servlets+JSP\testme.java:33: ‘class’ or ‘interface’ expected java CheckDBstatus http://xxx/tamino/Hermes ^ 1 error Perhaps I didn’t do it right? I also made sure that all of the permissions are now right (which they weren’t). Thanks again for the help! TJ

Hi TJ, I’ve attached the java program CheckDBstatus.java. Same it to disk and then compile with javac CheckDBstatus.java If the environemnt is setup correctly it will compile and be ready to run. Use a command like: java CheckDBstatus http://hostname/tamino/Hermes to run and test the Tamino database status. :smiley: Rob

Okay, not sure what happened with the attachment. Let me try this again with a zip file, CheckDBstatus.zip.

Rob - It seems like the zip file doesn’t like me very much either - I can’t get it to expand in windows or os x. Would it be easier to just email it to me? If so send it to tszewczak@mcc.commnet.edu. Thanks again! TJ Edit: (cue lightbulb over head) Now I actually understand what is going on here. I renamed my file to CheckDBstatus.java and I almost thought it was going to work for a second. I now get this error when using javac: C:>javac C:\Servlets+JSP\CheckDBstatus.java C:\Servlets+JSP\CheckDBstatus.java:20: cannot resolve symbol symbol : class TAccessFailureMessage location: package common import com.softwareag.tamino.db.API.common.TAccessFailureMessage; ^ 1 error I’m not sure why it can’t find TAccessFailureMessage, because it doesn’t seem to have any trouble finding TException, which is assume is also in the ‘common’ file. Edit 2: Success! . . Well sort of. I just deleted the line that referenced TAccessFailureMessage and it worked :slight_smile: Hopefully I’m not missing anything too important, which is causing that error! Thanks for all the help!