dear all,

I know how to correctly execute SQL statement using con.execute() (where con is type of java.sql.Connection). But how can I execute Microsoft Access Query Object, which require one or more parameters?

Do we need to use PrepareStatement ?

Thanks

Recommended Answers

All 5 Replies

dear all,

I know how to correctly execute SQL statement using con.execute()

No you don't, seemingly, since that's not right.

(where con is type of java.sql.Connection). But how can I execute Microsoft Access Query Object, which require one or more parameters?

Do we need to use PrepareStatement ?

Thanks

Statement, PreparedStatement, CallableStatement, whichever one is more suited to the task.
Read the JDBC tutorial.

I have manage to call Microsoft Access Query using CallableStatement, but there are still error regarding the Scroll Type (or whatever). I think it stuck, because I already made the scroll type to SCROLL_SENSITIVE/SCROLL_INSENSITIVE.

Any idea?

I don't know that Access supports Scrollable ResultSets over the bridge, but I'm not sure, and can't really tel you more, because I, myself, don't use Access. I find it to be the worst DB choice available.

the bridge driver was created before scrollable resultsets were invented...
And of course using CallableStatement to access SQL (rather than call a stored procedure) is idiotic.

Kid, do as you were told and work your way through the JDBC tutorial.

Thanks for all.
My problems (they are really plural) were solved, because I switch to Access from the former MySQL. I need an environment where I can prototype a lot of database design fast,where at the same time, a fully functional code were developed.

At phase where I don't really understand the whole problem, MS Access really help me : I can design the database very fast. Now, when I need to switch to MySQL for example, I just use database converter utility.

Yes, I don't have any problem when using MySQL. Everything works fine. But, when I switch to Access, problems start to occur.

Isn't Acces Query not the same as Stored Procedure as in any RDMS such as MySQL? (as long as I can remember, using VB 6, I get my Access Query listed in Stored Procedure category when I use Data Report).

I will be really helped, if I can call that sets of Access Query. For now, I just make a Singleton that hold all of my Query Statement ( I copy pasted them from MS Access Query View), and call them using simple Statement such as this one :

String[][] data = DB.getInstance().getDataSet(ApplicationLogic.getInstance().getAllCluster());

where in ApplicationLogic.java there exist a static method that return String :

..
public String getAllCluster(){
return "SELECT SkorKlaster.ID, Klaster_1.Kode, Klaster_1.Nama, Klaster_1.Keterangan, Klaster.Nama, SkorKlaster.Skor
FROM PemakaiBerkas INNER JOIN (Klaster INNER JOIN (SkorKlaster INNER JOIN Klaster AS Klaster_1 ON SkorKlaster.Klaster2 = Klaster_1.ID) ON Klaster.ID = SkorKlaster.Klaster1) ON PemakaiBerkas.ID = Klaster.NamaBerkas
WHERE (((Klaster.Nama)='safety') AND ((PemakaiBerkas.NamaBerkas)='Bridge Selection'))";
}
...

Yes, those long SQL where copy pasted from Microsoft Acces. Maybe I can code it in MySQL Query Browser, but, I think that will be imposible as I work on a lot of database application at once.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.