Jump to content

connect to isqlpluss with php?


jokkis

Recommended Posts

I working with a system, whith java and java servlet, but I want to use php on the web-site instead of java servlet.

My question is how to connect to the oracle sqlpluss?

I use the sql server on my school...

 

in java its work like this:

 

public class KobleTilDb {
    
   private Connection con; 
   private String koblingsstreng = "jdbc:oracle:thin:@oracle.nith.no:1521:STUD";   
   public KobleTilDb(String user, String passw) {    
      try { 
         //Steg 1 - laste database driver    
         Class.forName("oracle.jdbc.driver.OracleDriver");   //1)  
          //Steg 2 - oppretter forbindelse til db gjennom DriverManager
         con = DriverManager.getConnection(
                koblingsstreng, user, passw);  //2)
      }
      catch ( ClassNotFoundException cnfex) { //koblet til 1)
       System.out.println("Feilet med å laste driveren: " + 
                                 cnfex.getMessage());
       System.exit(1);
      }
      catch ( SQLException sqlex) { //koblet til 2) og 3)
            System.out.println("Tilkobling ikke mulig: " + 
                               sqlex.getMessage());
    System.exit(1);
      }

   }

   public void lukkForbindelse() {
      try { 
         con.close();
      }
       catch ( SQLException sqlex) { //koblet til 2) og 3)
            System.out.println("Unable to disconnect.");
    System.exit(1);
      }
   }
   
   public Connection getConnection() { 
       return con;
  }
}

 

thats no problem, men I dont know how to do this in php

 

I hope someone can help:)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.