[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Mush Lua connection to *.accdb

Mush Lua connection to *.accdb

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Fletchling   Australia  (54 posts)  Bio
Date Fri 07 Sep 2007 02:24 AM (UTC)
Message
Greetings all,

I'd very much like to create some triggers and aliases to read/write and query an access 2007 db.

Mush - 4.18
lua - 5.1
Access - 2007

example db = c:\program files\mushclient\zones.accdb
table = zones
fields = zone, text
= sw, text

I have most of it figured out, except how get this version of mush talking nicely with this version of access. So the real help I'd like is a simple alias to query the db for values, any sort of query will do as it help validate the connection path, version of luacom odbc etc.

Thanks in advance,
Fletchling aka Cuddlepie.
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 07 Sep 2007 06:50 AM (UTC)
Message
Have you read http://mushclient.com/faq, point 26?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #2 on Fri 07 Sep 2007 01:20 PM (UTC)
Message
Nick,

Yes, I've read that post quite a bit. I do like how you've captured so many frequent questions so succinctly. Putting the code you use as the example in point 26 in a plugin, I get this error;

(Have created the DSN correctly I'm sure, as tested using your MudDatabase plugin from ages ago)

Compile error
Plugin: dbtest (called from world: aardwolf)
Immediate execution
[string "Alias: "]:44: unfinished string near '"'

Then a second or so later, this error
--> TICK <--

Run-time error
World: aardwolf
Immediate execution
[string "Alias: "]:2: attempt to concatenate a nil value
stack traceback:
[string "Alias: "]:2: in main chunk

Clues gratefully appreciated.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #3 on Fri 07 Sep 2007 01:34 PM (UTC)
Message
What exactly are the aliases in question?

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #4 on Fri 07 Sep 2007 02:47 PM (UTC)
Message
Shaun,

The aliases are not created yet, as I cannot successfully connect to an access 2007 database (*.accbd file extension). When I can get any sort of link proven, the most basic anything to start with, then I'll be using this for all my lists of information I keep.

The question is not about the alias, it's about how to connect, using a non-specific alias as an example.

Thanks
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #5 on Fri 07 Sep 2007 02:48 PM (UTC)
Message
Oh, I should say I can connect to access 97 - 2003 just fine, it's the 2007 version in native '07 format I'm having trouble with.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #6 on Fri 07 Sep 2007 03:11 PM (UTC)
Message
Ah, that's quite a bit different then. Has the API for whatever function you are using changed between Access 07 and previous versions? I know that they stopped letting people use DAP unless it's through IE, and the DoCmd.RunCommand has been replaced. Without seeing the actual call in question through, there is no real easy way to narrow it down.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #7 on Fri 07 Sep 2007 04:18 PM (UTC)
Message
Shaun,
For an explicit example, try connecting Nick's MudDatabase to access '07 or (preferred) get the example mentioned earlier in point 26 of the mush FAQ to connect nicely to '07.
Thanks again.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #8 on Fri 07 Sep 2007 08:46 PM (UTC)
Message
That would require having Access. I don't have any of the Office suites, and I'm not sure how compatible OpenOffice would be for that, if at all.

The main thing I'm really concerned about is the \[string "Alias: "\]:44: unfinished string near '"' part. If there is a compiler error for the script, then that could throw off whatever alias you are using to test the database access.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #9 on Sat 08 Sep 2007 12:48 AM (UTC)
Message
Agreed the string error on 44 is a concern, I'd copied Nick's example verbatim (with appropriate change to DSN, UID and PWD). I am hoping for a minium set of code lines just to validate the connection, rather than perform a range of "real" functions.
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #10 on Sat 08 Sep 2007 01:20 AM (UTC)
Message
The code on:

http://mushclient.com/forum/?id=6324

does not have any aliases in it, so I can't see how you are getting an error in an alias, as reported.

To try that code snippet, use the Immediate window, that should at least get you going.

You shouldn't need Access installed, however you need to create a DSN using the Control Panel, as mentioned in that post. The name in the DSN is what you connect to.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #11 on Sat 08 Sep 2007 01:33 AM (UTC)
Message
Executing that snippet (with correct DSN etc) in the immediate window gives me this error;

Run-time error
World: aardwolf
Immediate execution
[string "Immediate"]:2: attempt to call global 'loadlib' (a nil value)
stack traceback:
[string "Immediate"]:2: in main chunk

I do appreciate your patience with this.
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #12 on Sat 08 Sep 2007 02:48 AM (UTC)
Message
The function loadlib is now in the package library (in Lua 5.1) so change "loadlib" to "package.loadlib".

I have amended the ODBC thread mentioned above to make this clear.

Also, under MUSHclient Global Preferences -> Lua, make sure that "Allow DLLs to be loaded" is checked.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


31,784 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]