jokkis Posted March 13, 2008 Share Posted March 13, 2008 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:) Quote Link to comment Share on other sites More sharing options...
trq Posted March 13, 2008 Share Posted March 13, 2008 I believe you use the oci8 extension to interact with oracle via php. Quote Link to comment Share on other sites More sharing options...
jokkis Posted March 13, 2008 Author Share Posted March 13, 2008 does somone have a code example that show how til connect to the database? Quote Link to comment Share on other sites More sharing options...
trq Posted March 13, 2008 Share Posted March 13, 2008 does somone have a code example that show how til connect to the database? Thats all covered in the link I gave you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.