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:) Link to comment https://forums.phpfreaks.com/topic/95952-connect-to-isqlpluss-with-php/ 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. Link to comment https://forums.phpfreaks.com/topic/95952-connect-to-isqlpluss-with-php/#findComment-491283 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? Link to comment https://forums.phpfreaks.com/topic/95952-connect-to-isqlpluss-with-php/#findComment-491344 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. Link to comment https://forums.phpfreaks.com/topic/95952-connect-to-isqlpluss-with-php/#findComment-491346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.