If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Connecting to MySQL from ASP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-28-03, 18:19
mcdyt mcdyt is offline
Registered User
 
Join Date: Aug 2003
Posts: 7
Unhappy Connecting to MySQL from ASP

Hi

I am trying to connect to a MySQL server from ASP with the following

set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
conn.Open "user=hullabulla;password=bulla;DSN=MySQL;DATABASE =hulla;SERVER=localhost;"
rs.ActiveConnection = conn

It does not work and a error is returned from

ADODB.Connection.1 error '80004005'

SQLState: IM002
Native Error Code: 0
[INTERSOLV][ODBC lib] Data source name not found and no default driver specified

I am using a web hotel so I can't change any options on the server.

Can you help me???

Last edited by mcdyt; 10-29-03 at 13:42.
Reply With Quote
  #2 (permalink)  
Old 11-01-03, 03:17
H2O H2O is offline
Registered User
 
Join Date: Oct 2003
Posts: 24
Have you tryed to connect to the same DSN with another program (e.g. Excel) just to check if the ODBC works OK ??

Just to get to the not working point.....


H2O
Reply With Quote
  #3 (permalink)  
Old 11-01-03, 11:56
aus aus is offline
Registered User
 
Join Date: Oct 2003
Location: Denver, Colorado
Posts: 137
Have you created a DSN named MySQL? Because ADO is complaining that you didn't. If you want to do a DSN-less connection, then you should use "Driver={MySQL ODBC 3.51 Driver};" and if your ODBC driver is older, try "Driver={MySQL};"
Reply With Quote
  #4 (permalink)  
Old 11-03-03, 17:44
digitalalias digitalalias is offline
Registered User
 
Join Date: Oct 2003
Location: Hollywood, FL USA
Posts: 4
Angry

Hey fellas,

I recently installed MySQL (version 4 I think). I'm running Windows XP Pro. I went into the command console (msdos) and created a database:

creat table patients...

I created a table too and tried to access it through ASP. It didn't work - please help. I'm a novice in connection.

Code:
strConnString = "driver={MySQL ODBC 3.51 Driver};server=localhost;database=patients;option=NUM"    
Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Open strConnString

Last edited by digitalalias; 11-06-03 at 06:11.
Reply With Quote
  #5 (permalink)  
Old 11-03-03, 17:47
aus aus is offline
Registered User
 
Join Date: Oct 2003
Location: Denver, Colorado
Posts: 137
How are you trying to access it? Are you using straight SQL statements or ADO recordset objects (like a table source)?

Quote:
Originally posted by digitalalias
...
I created a table too and tried to access it through ASP. It didn't work - please help. I'm a novice in connection.
...
Reply With Quote
  #6 (permalink)  
Old 11-04-03, 23:57
Radams58 Radams58 is offline
Registered User
 
Join Date: Nov 2003
Posts: 17
2 Strings

DRIVER=MySQL ODBC 3.51 Driver;UID=hullabulla;STMT=;OPTION=;PORT=;PASSWORD =bulla;SERVER=remote;DATABASE=hulla;DESC=;
DRIVER=MySQL ODBC 3.51 Driver;UID=hullabulla;STMT=;OPTION=0;PORT=;PASSWOR D=bulla;SERVER=localhost;DATABASE=hulla;DESC=;

the two strings above are for dsn-less connections from ASP, we use the snot out of them where I work so it's a lot easier not to setup a DSN each time.

That said, you need to have MyODBC 3.51.xx installed on the computer that will be accessing the data.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On