Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Problem in setting a Data Connection

Avatar

Level 9

Hello All ,

I am trying to learn how to create a Database connection to a form . I am just only using a textfield which will act as UserID . I am Using MySQL 5 Client and the server lies on another machine . I have created a table where UserID = Varchar , Primary Key , NotNull . I have created a DSN using OLEDB database named as Mail . The table name is mail  in the database.I have followed the following methods.

File - > New Data Connection - > OLEDB Database - > Connection String -> Build ->Micosoft OLEDB Database Provider for ODBC drivers - > Use Connection String - > Build - > DSN Name (Selected Mail) - > ODBC dBASE setup -> OK - > Test Connection - > Succeeded - > OLEDB Connection - > Record Source - > Table .


Here the problem arrises . I am not able to see my table name in the dropdown list . I know its like an idiotic question . But I am not able to solve .Is there any one who can help me out ?? Anyone can suggest some good online videos about this things ?

Thanks .

Bibhu .

31 Replies

Avatar

Former Community Member

If you set it to SQl Statement then you woudl have to write each of the statements in script (there were exampls that you were pointed at earlier). If you leave it at table then upi can use the functions next, previous etc ...

The advantage of table is that you do not have to write script but it is not very flexible. The advantage of SQL is that it you can do whatever you want but you have to write script.

Paul

Avatar

Former Community Member

You have sent me the source for the template ....which I cannot do much with. I have a

MySQL installation ...can you send me your form and export the DB and I will try it here.

You can send the information to LiveCycle8@gmail.com

Paul

Avatar

Level 9

Hello Paul ,

I made my form work after some hit and trial operations . What I did is I have put an update button . First I click on the addNew button then after inserting the record I clicked on the update button . As a result the new record is reflected at the DB . So what I guess here is the DB is not updated until you click on the Update button . Is it true ?? More over I have specified the UserId as auto-increment and didn't write any SQL query for it , simply I used Table . Still I got the answer . So here another question comes is it necessary to use SQL query id you have an auto increment column ?? In addition after inserting the data as add new operation followed by an update operation the auto incremented column( in my case UserId) show value zero only in the form itself not in the DB . Again I am confused here .

Thanks.


Bibhu.

Avatar

Former Community Member

If you have an auto increment column then when you addnew() the record will be created and the auto incremented field shoudl be left alone. When you click the update then the fields will be updated. I think you are overridding your autoincremented field the way you have it now.

Paul

Avatar

Level 9

Hello Paul ,

Forget about the auto increment for some moments . What I want to ask is : Do we need an update operation exclusively after adding the rows . Cant we simply add rows without updating it ?? If we can , then what's wrong in my approach / form ??

Thanks.

Bibhu.

Avatar

Former Community Member

No most data bases make you add a blank row then do an update. If you change to SQL commands then you can do an insert which does both at the same time.

Paul

Avatar

Level 9

Hello Paul ,

Is it possible to write multiple SQL statements ?? For example I want to do all possible operations . If I will write only INSERT statement in the SQL query , is it possible to carryout other operations too ??

Thanks ,

Bibhu .

Avatar

Former Community Member

Yes but you woudl be doing it through script ...not through that interface

paul

Avatar

Level 9

Hello Paul ,

Could you please give some example here or can suggest a link where I will be able to see the use of SQL statements in script rather than the interface itself ?

Thanks,

Bibhu

Avatar

Former Community Member

This is the same one that I mentioned at the very beginning. In this case he is only executing one SQL statement but it is the principal that you are after.

http://forms.stefcameron.com/2006/09/29/selecting-specific-database-records/

Paul

Avatar

Level 9

Thanks a lot Paul for bothering me . This stuff will make some value addition .

Bibhu