Results 1 to 25 of 25

Thread: ODBC problem!

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Exclamation ODBC problem!

    Hello to all, \\

    ty for all usefull topics of this forum.

    subject :

    my application have odbc connection with *.mdb database
    if the user has administrator privilages applications works fine!

    but if user has not administrator privilages odbc connection doesnt work....

    how can i make odbc connection work for all users? admins or limited users on windows?

    thanks for any help

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ODBC problem!

    By ODBC connection, do you mean an ODBC DSN (which you can set up in Control Panel)?

    If so you don't really need one, as you can put all of the details within your program (it's much safer that way, as it can't be 'accidentally' deleted/changed).


    Next up, what do you mean by "doesn't work"?

    Depending on what the answer to that is, the problem may be due to permissions on the database file/folder. See this FAQ thread for how to set them up properly.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    Quote Originally Posted by si_the_geek
    By ODBC connection, do you mean an ODBC DSN (which you can set up in Control Panel)?
    yes this is the type of my connection

    [QUOTE=If so you don't really need one, as you can put all of the details within your program (it's much safer that way, as it can't be 'accidentally' deleted/changed).
    [/QUOTE]

    how can i do that?



    [QUOTE=Next up, what do you mean by "doesn't work"?
    [/QUOTE]

    when i try to start my application in a user account with limited privilages
    i take the message : you dont have enter the right password for connection with database.

    if i start my application with right clik run as.... administrator and i give the password program starts five.

    details for what i want to protect :

    my application is in c:/program files/ connected with a password protected mdb database. as all we know mdb databases password crack verry easy with some progs, limited users cannot install those (bad ) progs...

    an other problem is replacing the database of the program with backup database from another day (before today or the same day but earlier time) and "cheat" records....!!
    for example if some user copy database and put it in folder backup1, make some records , print receipt from program, take the money from customer and then replace database with database from backup1 folder....

    so i put my appz to c:/program files/ to protect it from users, because limited users canot replace any file i n c:/program files/

    you have any idea? \\


    thanks for advise

  4. #4
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: ODBC problem!

    The absolute best thing you can do is to switch from ODBC to DSN-Less connection in your code and not have to worry about such things. Look in my signature for Connection strings for more help.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ODBC problem!

    Exactly how you would use a DSN-less connection depends on what connection technology you are using... if it is ADO code, then this is how to do it:
    VB Code:
    1. [i]objConn[/i].ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
    2.                              & "Data Source=C:\Program Files\Folder\My Database.mdb"
    ..basically wherever you have a connection string (or the DSN name) at the moment, change it to a connection string like this (or one in the link that randem and I both have in our signatures).

    Quote Originally Posted by Chrisad
    so i put my appz to c:/program files/ to protect it from users, because limited users canot replace any file i n c:/program files/
    Well that's the problem then.. in order to be able to modify data in an Access database at all, they need the ability to modify the file (and create/modify files in that folder) as described in the link I provided before.

  6. #6
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: ODBC problem!

    Are you using a system DSN instead of a user DSN?

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    Quote Originally Posted by leinad31
    Are you using a system DSN instead of a user DSN?
    i try both, but the same problem.

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    Quote Originally Posted by Well that's the problem then.. in order to be able to modify data in an Access database at all, they [i
    need[/i] the ability to modify the file (and create/modify files in that folder) as described in the link I provided before.
    what is the solution of this? haw to protect my database from replacing?

  9. #9

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    Quote Originally Posted by randem
    The absolute best thing you can do is to switch from ODBC to DSN-Less connection in your code and not have to worry about such things. Look in my signature for Connection strings for more help.

    i have a lot of thinks to read... thanks m8

    i will try it

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ODBC problem!

    Quite simply, don't use Access.. as it deals with Files, not true databases - and in order to modify a file at all, you need permission to modify the file however you like.

    In order to have that kind of protection you need proper database software, such as SQL Server 2005 Express (see the thread at the top of the DB forum for a link to the Free download), which uses an 'engine' to do the actual work with the database file(s).

  11. #11
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: ODBC problem!

    Not being able to replace a database with a backed-up database would be a serious FLAW!!! What you might want to incorporate is that each day you enter an encrypted code in the database and the registry so that if a backup database is used your software would know it and could perform warnings and alerts that this is happening and would need special permissions to do so.

  12. #12
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ODBC problem!

    Yes but the problem is that the actual file itself could be changed, hence losing the data of the previous day (or hour, ...).

    Without having some kind of automatic backup & restore system (which would also be prone to issues), Access is not a valid option given the requirements.

  13. #13
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: ODBC problem!

    To get per user access in MS Access you'll have to do "gymnastics" (also involves registry settings), and you'll have to pass first the admin log so consider instead using another DB such as SQL Server which has better support for user access.

  14. #14

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    Quote Originally Posted by leinad31
    using another DB such as SQL Server which has better support for user access.
    i remember that for my next appz..

    now i have a idea..

    is there any way to include in my code run as...administrator fuction?

    because if i run the program with right click run as.... administrator app start five

  15. #15
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ODBC problem!

    Why can't you switch to SQL Server Express?

    There should be very few changes needed to the code (usually just the connection string, and wildcards for Like queries).


    It is possible to do "run as" via code, but I cannot recommend (or even condone) that, as the login details need to be stored in your program - even when it is compiled, they can be read by anyone who opens it in NotePad.

  16. #16

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    Guys thank u all.

    always helping me here...

    propably i find a solution

    solutions name Autoit

    this program compile scripts to exe

    i write this script

    Code:
    ; Declare all variables used
    Dim $Username, $Password
    
    ; Initialization of the variables
    $Username = "test"
    $Password = "test"
    
    ; Set the RunAs parameters to use local adminstrator account
    RunAsSet($Username, @Computername, $Password)
    
    Runwait(@ProgramFilesDir & '\company\prog\prog.exe')
    so appz users can run appz from this exe with admin privilages

    and make me little more happy about.

  17. #17

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    [QUOTE=It is possible to do "run as" via code, but I cannot recommend (or even condone) that, as the login details need to be stored in your program - even when it is compiled, they can be read by anyone who opens it in NotePad.[/QUOTE]

    i compile the script and open the executive file with notepad and search for user or password... i didnt find anything

    can you help me about ?

    i attach txt


    thans alot one more time
    Attached Files Attached Files

  18. #18
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ODBC problem!

    I had a quick visual scan in Notepad and didn't spot it (you need to be aware it is in unicode, so a Find wont get it).. but it doesn't matter anyway - AutoIt provide a decompiler, so you can see the original script.

  19. #19

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    WELL....,

    @si the geek you have right about decompiler, but i m 100% possitive tha my users dont even try about it...

    but GUYS i found onother solution and i want to talk about with you.

    at folder options in view tab there is one option :

    use simple file sharing (recomended)




    if we un-check this option we will see another tab to all files (right click--properties)



    SECURITY!!!

    and we give permisions to any users we want to read & write our database..


    i test it and looks fine!!!

    what is your opinion about?

    thanks again

  20. #20
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: ODBC problem!

    Sounds like a deployment nightmare to me. Why put the database in a place where it is hard to get to then go thru these procedures to give access to it anyway?

  21. #21

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    @randem

    thats why...
    an other problem is replacing the database of the program with backup database from another day (before today or the same day but earlier time) and "cheat" records....!!
    for example if some user copy database and put it in folder backup1, make some records , print receipt from program, take the money from customer and then replace database with database from backup1 folder....

    so i put my appz to c:/program files/ to protect it from users, because limited users canot replace any file i n c:/program files/

    please before post read first, you dont help if you take us back...

    ty Chrisad

  22. #22
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ODBC problem!

    Quote Originally Posted by Chrisad
    SECURITY!!!

    and we give permisions to any users we want to read & write our database..


    i test it and looks fine!!!

    what is your opinion about?
    That's what the FAQ thread that I linked in my first reply talks about.

    If you are certain that everything works without ticking "Modify" (and the permissions for the folder itself), then it should be safe.


    What randem and I are both confused about tho, is why go to this much effort (in which at some point you may make a mistake, or accidentally leave a loophole) when using a 'proper' DBMS would instantly solve issues like this?

  23. #23
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: ODBC problem!

    EXACTLY Si.... and he Talks about reading....

  24. #24

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: ODBC problem!

    @randem its not personal attack for you my comment, but you ask me somethink that i allready explaned verry well.

    if you take it as personal attack i m sorry about that, its a mistake.

    _____________________________________________________________


    Quote Originally Posted by si_the_geek
    What randem and I are both confused about tho, is why go to this much effort (in which at some point you may make a mistake, or accidentally leave a loophole) when using a 'proper' DBMS would instantly solve issues like this?
    @si_the_geek

    you have right to be comfused about, but i dont have much time to change
    appz to work with more secure and better connection string as sql.
    propably next version priority is sql database.....

    but now i cant do that because i havent much expirience about this type of connections and i thing tha it take me much of my time.

    my prog allready works for my costumer and everything works fine but as administrator account...

    i must find a solution to run my appz from limited user account (to close the big hole of replacing database) and then i find the time to fix my next version more carefully and much more secure.


    thanks all for your time

    sorry again @randem

  25. #25
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ODBC problem!

    In our opinions (and I would assume that of many other professionals), it will be significantly easier to move to a different database system than to create dubious fixes as you are attempting to do.

    The problem occurred because you didn't investigate enough.. and are trying to fix it by adding dodgy (unreliable/unsafe) hacks to the system, rather than simply spending a little while learning how to use safer software - which you say you are going to do anyway. Why spend the extra time trying to find dubious solutions?

    Getting something like SQL Server Express is very easy, installing it is easy too. The changes to your program will be minimal (probably just one line - the connection string). The only awkward part is copying your database/data from Access to a real database system.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width