Connection String in PHP using JDBC
Moderator: General Moderators
Connection String in PHP using JDBC
Hi Everybody,
Can we connect any database in php using JDBC. If Yes then please let me know woh we can connect it or if not then what is the reason behind it.
With Regards
Rajani Gupta
Can we connect any database in php using JDBC. If Yes then please let me know woh we can connect it or if not then what is the reason behind it.
With Regards
Rajani Gupta
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: Connection String in PHP using JDBC
JDBC is an API for Java to connect to databases. Why would you need to use JDBC in PHP?
Re: Connection String in PHP using JDBC
i need to know only that how can we connect oracle using php? JDBC connectivity is possible in php or not.
Re: Connection String in PHP using JDBC
We are using server which is supporting only JDBC connections.
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: Connection String in PHP using JDBC
Your Oracle server only accepts JDBC connections? Well, in that case, you're going to have trouble connecting to it using PHP.
If not, PHP has extensions for working with Oracle. This search told me that.
If not, PHP has extensions for working with Oracle. This search told me that.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Connection String in PHP using JDBC
Hi Rajani..
I am stuck with the same pbm. I want to know how can I get jdbc connection in php. If you have got the solution plz reply
I am stuck with the same pbm. I want to know how can I get jdbc connection in php. If you have got the solution plz reply
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: Connection String in PHP using JDBC
Theoretically you could actually do it, but it'll be much better for you if you just reconfigure the database to not only accept JDBC connections.
Re: Connection String in PHP using JDBC
I am trying to integrate php and jasper reports. I have to generate a report from db and for that I need a jdbc connection object in php. Could any one please help me on this. I have referred some links on google .They all mention the same process of creating an instance of a java class and then calling a getConnection() method of that class.
Following the getCOnnection() method
But when I call this method from php it doesnt return me anything . Could anyone please help me. Actually I need the connection object to send as a parameter to Jasper report FillManagerClass.
Following the getCOnnection() method
Code: Select all
public Connection getConnection()
{
Connection conn = null;
try {
//Change these settings according to your local configuration
Class.forName(this.getDriver());
conn = DriverManager.getConnection(
this.getConnectString(),
this.getUser(),
this.getPassword());
//return conn;
}catch(ClassNotFoundException e){
e.printStackTrace();
}catch(SQLException e){
e.printStackTrace();
}
return conn;
}
Last edited by Benjamin on Thu May 14, 2009 4:31 pm, edited 2 times in total.
Reason: Added [code=java] tags.
Reason: Added [code=java] tags.