Access Denied For User
Hello, I have a Linux server running Apache, MySQL, unixODBC, MyODBC In my odbcinst.ini file I have the following: [MySQL] Description= ODBC for MySQL Driver = /usr/local/lib/libmyodbc3.so FileUsage = 1 I have setup the following system DSN in the odbc.ini file: [PbDatabase] Description = System DSN Driver = /usr/local/lib/libmyodbc3.so Host = localhost Server = localhost User = username Password = password Port = 3306 Database = Database01 Option = 3 However, when I use the System DSN name in my scripts I get the following error: 350 Native SQL Error Code [unixODBC][MySQL][ODBC 3.51 Driver]Access denied for user: '[EMAIL PROTECTED]' (Using password: NO) The user apacheusr is the username that the Apache webserver is running under. I've tried adding this user to the MySQL user table but the error still shows. However, if I add the Username and Password along with the DSN name to my scripts within my HTML pages then the connection is made and records from the database returned. Any ideas why this might be happening?? Is it a permissions issue with MySQL or with unixODBC or Apache?? Any help would be greatly appreciated. Thanks in advance [EMAIL PROTECTED] -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.306 / Virus Database: 266.4.0 - Release Date: 22/02/2005 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Time in VBA for Excel
Hi Dan, Sorry for causing additional work to getting the test setup, I will take your advice should I need to post these type of details again With regards to your solution, it works perfectly!!! Great thanks for putting the time and effort in to help sort this problem. Much appreciated. I didn't even know you could connect without a DSN in VBA. I'm basically teaching myself VBA from doing tutorials and experimenting. I'll take a look on the net and see how the DSN-less connection is done. Thanks for the heads up. Kind Regards [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Time in VBA for Excel
Hey Dan, Thanks for the post and the code ideas. Unfortuantely I still can't get the thing to work even when trying the CONCAT and CAST functions. As per your request, here is the details of what I have got so far: I'm running MySQL 4.1.9 with MyODBC 3.51. The table in question is the Users table which has been setup as follows USERS = UserID INT(11) NOT NULL AUTO_INCREMENT, CompanyCode TEXT NOT NULL, AssessmentCode TEXT NOT NULL, UserCode TEXT NOT NULL, Profession INT(5) NOT NULL DEFAULT '0', Category INT(5) NOT NULL DEFAULT '0', Username VARCHAR(10), Password VARCHAR(10), AssessmentDate DATE, StartTime TIME, EndTime TIME, Completion ENUM('Y','N') NOT NULL DEFAULT 'N', The sample data I'm working with is: UserID :: 1 CompanyCode :: BEC-24ECMQP-TFXCFDOY-290105 AssessmentCode :: BEA-24ECMQP-O701-290105 UserCode :: BEU-24ECMQP-XR01-290105 Profession :: 12 Category :: 2 Username :: BEU1 Password :: password AssessmentDate :: 2005-03-05 StartTime :: 12:33:59 EndTime :: 14:33:24 Completion :: Y Here is my VBA Code that aims to get the data from the database and insert it into a worksheet. I'm pretty new to VBA coding so please excuse any bad form == Sub UserData() Dim calcMode, updateMode Dim ws As Worksheet Dim conn As ADODB.Connection Dim rec As New ADODB.Recordset Dim qtTarget$, sqlQuery$, strAssCode$, strCoCode$ Dim i, intUsrCount% calcMode = Application.Calculation updateMode = Application.ScreenUpdating Application.Calculation = xlCalculationManual Application.ScreenUpdating = False strCoCode = ThisWorkbook.Worksheets(AssmntInfo).Range(C8).Value strAssCode = ThisWorkbook.Worksheets(AssmntInfo).Range(M8).Value Set ws = ThisWorkbook.Worksheets(UserInfo) qtTarget = ws.Names(UsrList).RefersToLocal Set conn = OpenDatabase If conn Is Nothing Then Exit Sub sqlQuery = SELECT ud.UserCode, ct.CategoryDesc, ud.StartTime, ud.EndTime, TIMEDIFF(ud.EndTime,ud.StartTime) AS TotalTime _ FROM Users AS ud _ RIGHT JOIN Categories AS ct ON ud.Category = ct.CategoryID _ WHERE ud.AssessmentCode = ' strAssCode ' AND ud.CompanyCode = ' strCoCode ' _ ORDER BY ud.UserID ASC rec.Open sqlQuery, conn With ws .Range(qtTarget).ClearContents i = 7 intUsrCount = 1 While Not rec.EOF .Cells(i, 2) = intUsrCount .Cells(i, 3) = rec!UserCode .Cells(i, 4) = rec!CategoryDesc .Cells(i, 5) = rec!StartTime .Cells(i, 6) = rec!EndTime .Cells(i, 7) = rec!TotalTime i = i + 1 intUsrCount = intUsrCount + 1 rec.MoveNext Wend intUsrCount = intUsrCount - 1 .Range(J6) = intUsrCount .Activate .Cells(7, 2).CurrentRegion.Select .Names.Add Name:=UsrList, RefersTo:== + Selection.Address End With ThisWorkbook.Worksheets(AssmntInfo).Cells(18, 13) = intUsrCount rec.Close conn.Close Application.Calculation = calcMode Application.ScreenUpdating = updateMode Application.Calculate End Sub Function OpenDatabase() As Connection Const DBS$ = DSN=Assessment; _ Uid=username; _ Pwd=password; Dim conn As ADODB.Connection On Error Resume Next Set conn = New ADODB.Connection With conn .CursorLocation = adUseClient .Open DBS End With If Err 0 Then MsgBox REPORT GRAPH GENERATOR ERROR: _ vbCrLf Could not connect to database. The report graph processing will be stopped. Exit Function End If Set OpenDatabase = conn End Function == Any further ideas or help will be greatly appreciated. Kind Regards [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Time in VBA for Excel
Hello, I have a table in my database with two fields set as Time types. The issue I seem to have is when I use an ADO connection in VBA for Excel to select the two fields. Instead of the expected format HH:MM:SS held within my recordset, I get the current date in the format DD/MM/. Then should it reach a record where the time has been set to the default 00:00:00 I get an error Invalid Use of Null I tried outputting the data from the database to a webpage using scripting and I'm returned with the correct data as entered into the database. This is also confirmed when I view the data in the Query Browser. I've gone through every VBA site possible and found no clues so thought there might be a MySQL wizz that knows what is going on Any help or pointers would be greatly appreciated!! Thanks in advance [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Exporting Replication
Hello Everyone!! I've just joined this list and have already started to enjoy the various threads that are running. I also wanted to get some feedback on something that I'm trying to do. I have currently developed a survey system that uses a mysql database that consists of 15 tables. The database is kept and administered on the server in the office and then dumped out and copied across to a notebook server which we then take out to run our application and which then get updated with user input. When we return back to the office the database is dumped out and replaces the one on the office server. The first issue is that we now have the need to run two notebook servers, which mean we can't just dump the data out and copy it across. The second issue is that the company data we are holding is getting way too big to carry around on the laptops. What I want to do is to keep the office based database as the admin, allowing us to add companies and users etc... I then, for each survey workshop, want to be able to output 11 tables exactly how they appear on the office database with the other 4 tables being empty structures that I can insert smaller amounts of company and user data into. Having read the manual I think it comes to doing it one of two ways: 1) Use replication to keep the 11 tables up to date and then use create table to build the other 4 tables. 2) Use create table to build the workshop databases from the main database. Any advice on the best solution would be greatly appreciated. Thanks in advance Regards D@n == Design evokes emotion, gives identity, communicates an idea and compels a response __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.comm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php