RE: your odbc problem can be solved

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Great, the error message is gone so I am assuming that it have it right
so far.

Now, my question is on syntax and logic.  I have a RecordSet class I use
when I connection to a MySQL.  It's basically like this:

class RecordSet
{
	//var name	

	function RecordSet($sql)
  	{
        		$this->setDBConn(mysql_connect("localhost",
"username", "password"));
        		mysql_select_db($this->getDBName(),
$this->getDBConn());
        		$this->setResultID(mysql_query($sql,
$this->getDBConn()));
  	}
	
	//Appropriate Gets and Sets
}

I then do something like this

$objRecordSet = new RecordSet($sql);
if (mysql_num_rows($objRecordSet->getResultID()) != 1)
{
	blah blah blah
}

I want to do the same with the ODBC functions.  So basically, just be
able to create a new RecordSet class and pass it a query.  


I'm pretty hard pressed for time and have not found the "right" info on
the web which is why I am asking what I am asking.

Thanks in advance. 

---> Jonathan
 
 
 

-----Original Message-----
From: John A DAVIS [mailto:John.A.Davis@state.or.us] 
Sent: Friday, February 14, 2003 10:45 AM
To: jvilla@isdesigndev.com
Subject: your odbc problem can be solved

That's fine, but you need to do this on the machine that has the web
server, even if it's pointing at another machine that has the database.
Why? Because the "web server" is the one trying to access the database
with an ODBC driver (Open Database Connectivity), not the user.

For some reason, my answer wasn't posted yesterday.




Ok, this is what I did...

Keep in mind I have Xp so I don't know how this all pans out.

1. I opened the ODBC Data Source Administrator
2. My default view was User DSN
3. I clicked on System DSN
4. Clicked on Add
5. Choose Microsoft Access Driver (*.mdb)
6. Gave it a name of Killerspin_com2
7. Clicked on Create 
8. Saved it the directory which my source code will reside in.
9. Set up username/password
10. created test_connect.php page.
11. Inserted the following code:

if (odbc_connect("killerspin_com","username","password") == 0)
	die("failed");
else
	die("success");

12. Received this error.

Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name
not found and no default driver specified, SQL state IM002 in SQLConnect
in D:\is\clients\eki\killer_spin\new_web\test_connect.php on line 3
Failed.

I'm not to sure how to set this up to work with PHP
 
---> Jonathan
 
 
 

-----Original Message-----
From: Griffiths, Daniel [mailto:DANIEL.GRIFFITHS@conconf.org] 
Sent: Friday, February 14, 2003 3:38 AM
To: jvilla@isdesigndev.com; php-db@lists.php.net 
Subject: RE:  How to access a MS Access DB 

to set up a DSN go to control panel and then Administrative Tools then
into Data Sources and then add a new system DSN.
you can probably work the rest out as its fairly straight forward.

-----Original Message-----
From: Jonathan Villa [mailto:jvilla@isdesigndev.com] 
Sent: 13 February 2003 22:48
To: php-db@lists.php.net 
Subject:  How to access a MS Access DB 



I need to know exactly how to hook up to an Access database under Office
Xp.  I normally use MySQL, but the current site sits on Windows servers.

I am using php 4.3.0
Office Xp Pro w/ Access
I'm running Apache 2.0.43

I need to know how to check if ODBC is set up on my machine (I hear that
by default it is) and what's this about a driver?

All I know at this point is 

odbc_connect("XXX","username","password");

Where XX is the DSN name I will be using, (how do this, i.e. set up a
DSN name)

Thanks much and in advance.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux