سؤال

currently I am working with PHP. And I would like to connect PHP and Derby Database. But, unfortunately, everytime I tried to connect them, I got these warning:

Warning: odbc_connect(): in D:\Programme\xampp\htdocs\test_derby.php on line 7

Warning: odbc_autocommit() expects parameter 1 to be resource, boolean given in D:\Programme\xampp\htdocs\test_derby.php on line 12

Warning: odbc_do() expects parameter 1 to be resource, boolean given in D:\Programme\xampp\htdocs\test_derby.php on line 15

Warning: odbc_result_all() expects parameter 1 to be resource, null given in D:\Programme\xampp\htdocs\test_derby.php on line 16

Fatal error: Call to undefined function DbDisconn() in D:\Programme\xampp\htdocs\test_derby.php on line 17

Here is My Code:

$username = "sysdba";
$password = "masterkey";
$dsn = "Driver=jdbc:derby://localhost:1527/gasteparkplatze";

$conn = odbc_connect($dsn,$username,$password);

odbc_autocommit($conn, TRUE);

$que = "select * from gastgeber";
$res = odbc_do($conn, $que);
odbc_result_all($res, "BORDER=1");

NB: The username and password is default Derby's default username and password. Correct me if am wrong, because I got that username and password from following link: http://www.sysaid.com/Sysforums/posts/list/7400.page

Thanks in advance.

هل كانت مفيدة؟

المحلول

You need a ODBC driver not a JDBC one to use odbc_connect. Easysoft have a ODBC Driver for Derby, they also have a ODBC-JDBC Bridge that would allow what you are doing to work. The ODBC driver is the simpler cleaner solution. ODBC Driver for Derby

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top