Mainframe java connectivity



Support for Java SE, EE & ME, JVM, JNI, JDBC, EJB, JFC, JPDA, JAAS,JCE, JAXP, XML and Java API.

Mainframe java connectivity

Postby shuzzeus » Wed Feb 01, 2012 7:39 pm

How can i access db2 in mainframes with my application which is in java?How can i make this connectivity.i want to use db2 as backend which is in mainframes.
shuzzeus
 
Posts: 8
Joined: Wed Feb 01, 2012 7:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: mainframe java connectivity

Postby enrico-sorichetti » Wed Feb 01, 2012 7:45 pm

googling with java db2 connectivity returned more than 1000000 hits
what happened when You searched Yourself ?
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: mainframe java connectivity

Postby shuzzeus » Wed Feb 01, 2012 8:14 pm

i did!! i found ways which uses some external drivers.
i made an app. in java, where i want to access that db2 database.
so i was wondering to do with soap/xml messages or any service with which i can access it.
shuzzeus
 
Posts: 8
Joined: Wed Feb 01, 2012 7:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: mainframe java connectivity

Postby shuzzeus » Wed Feb 01, 2012 8:18 pm

i created many app. but whole are in mainframes.in this,my app. is in windows and my database is in mainframes.so how can i access it?
shuzzeus
 
Posts: 8
Joined: Wed Feb 01, 2012 7:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: mainframe java connectivity

Postby Ed Goodman » Thu Feb 02, 2012 9:07 pm

You would first need to find out which of the many many ways of doing this your site has decided to support. On the mainframe side, they may have implemented JDBC connectors, or maybe a DataBean interface, or maybe an ODBC-type interface. Like you said, there are a lot of ways to do it.

However, if you pick a different one than the folks running them mainframe picked, you won't get connected.

Ask around at your shop and find out what other mainframe apps are sending data to java apps, then do whatever they did. The only thing I can tell you with any certainty is that you aren't going to like it. No matter what they used, you're going to think they should have used something else.

Also, don't confuse the connection layers with the tools that work on them. We just went through that this week. I was hearing things like "this is how this system passes data" when if fact, it was how the WebSphere wizard works. Once you looked at the code the wizard generated, you could see what was really happening.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: mainframe java connectivity

Postby shuzzeus » Fri Feb 03, 2012 1:53 pm

ED Goodman:

Thanks for your reply.
actually my all application were in same platform.this new application i never developed.i am developing it first time.i know many of sites using web interface in java/.net/php uses mainframe as backend but no idea about their technical connectivity.i want to know how can i go for this application (web page in front and mainframe db2 as backend).
shuzzeus
 
Posts: 8
Joined: Wed Feb 01, 2012 7:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: mainframe java connectivity

Postby Ed Goodman » Fri Feb 03, 2012 10:01 pm

I get that you are doing this for the first time. What I'm telling you is that for that particular mainframe where your DB2 is stored, it is NOT the first time someone needed to do it. Therefore, that mainframe has already (probably) created a conduit that you should use. You need to research your site specifically and find out what has already been installed to be used.

Once you know that they are using a given connectivity method, then you can find out how to do the Windows side of it. You'll use the Windows method that matches the method that is already working on your mainframe.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: mainframe java connectivity

Postby jaggz » Mon Feb 20, 2012 10:25 am

Hello Shuzzeus,

You can get this done by installing a driver(Type 4) Connection. There is book on " Application Programming guide and Reference for Java - SC18-7414-05". You can also review on JZOS which comes with JAVA install pack(/usr/lpp/java/j6_0_1).

This code will connect the DB2 :-

 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.DriverManager;
 import java.sql.Connection;
 import java.sql.SQLException;
 public class Sample
 {
   public static void main(String args[]) throws ClassNotFoundException
      {
         System.out.println("CONNECTING TO DATABASE");
         try
         {
         String locale1 = System.getProperty("user.language");
         System.out.println("The Locale of the system is:"+locale1);
         String useName = System.getProperty("user.name");
         System.out.println("The User of the system is: "+useName);
               Class.forName("com.ibm.db2.jcc.DB2Driver");
               String url="jdbc:db2://x.x.xxx.x:446/DB2LOCATION";

               String user="CUSTOM1";
               String password="abc123";
        Connection con=DriverManager.getConnection(url,user,password);
               PreparedStatement psmt=null;
               ResultSet rs=null;
               if (con != null)
                {
                   System.out.println("CONNECTED TO DB");
                   psmt = con.prepareStatement("SELECT * FROM STUDENT");
                   rs = psmt.executeQuery();
                   if (rs != null)
                   {
                     System.out.println("FETCHING");
                     while (rs.next())
                     {
                       System.out.println(rs.getString(2));
                     }
                   }
                }
               else
               {
                  System.out.println("NOT CONNECTED");
               }
           }
          catch(SQLException e)
          {
              e.printStackTrace();
          }
       }
    }


HTH
Jaggz
User avatar
jaggz
 
Posts: 356
Joined: Fri Jul 23, 2010 8:51 pm
Has thanked: 8 times
Been thanked: 5 times

Re: Mainframe java connectivity

Postby ashima08 » Mon Jul 26, 2021 1:45 pm

The Java program would use your favorite SOAP (or MQ) infrastructure to communicate with the CICS/COBOL program. For option 2, your CICS/COBOL program would have to be coded to be "web-aware." The CICS/COBOL program would have to use the WEB EXTRACT, WEB RECEIVE, and WEB SEND APIs to communicate with the Java program.
https://www.yatharthmarketing.com/sales-training-programs.html
ashima08
 
Posts: 3
Joined: Mon Jul 26, 2021 1:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Mainframe java connectivity

Postby Terry Heinze » Mon Jul 26, 2021 7:08 pm

Did you notice that you replied to a 9 year old topic?
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times


Return to Mainframe Java

 


  • Related topics
    Replies
    Views
    Last post