Board index » delphi » Re: Getting started

Re: Getting started


2003-07-10 08:29:36 PM
delphi123
There are several IBX articles linked at
delphi.weblogs.com/articles
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : delphi.weblogs.com
IB 6 versions prior to 6.0.1.6 are pre-release and may corrupt
your DBs! Open Editon users, get 6.0.1.6 from mers.com
 
 

Re: Getting started

Craig Stuntz [TeamB] writes:
Quote

There are several IBX articles linked at
delphi.weblogs.com/articles

Thanks, Ive already got some thing going after reading just a little.
 

Re: Getting started

I am just getting started. To teach myself, I am trying to write a
little app to convert some Paradox databases to Datastore. I am trying
to use setConnection. What do I put in Driver String in order to use a
W2000 ODBC driver or am I going about this in the wrong way?
Jochen Haber
 

Re: Getting started

Jochen Haber writes:
Quote
I am just getting started. To teach myself, I am trying to write a
little app to convert some Paradox databases to Datastore. I am trying
to use setConnection. What do I put in Driver String in order to use a
W2000 ODBC driver or am I going about this in the wrong way?
It's not clear as to which database you are trying
to connect to: Paradox or JDataStore? And what
is "W2000"?
You mention ODBC, so I get the feeling that you
are trying to connect to the Paradox database.
I'm not sure that is possible, but since I have
never worked with Paradox, I am only going by
what research I can do -- that is, a search
of the newsgroup archives reveals that only
a Type 3 JDBC driver is available for Paradox.
(You don't really want to go there.)
If you mention ODBC with respect to JDataStore --
"danger Will Robinson!" -- don't do that. I repeat:
DO NOT use an ODBC driver!
Use the JDataStore Type 4 JDBC driver which comes
with JBuilder.
Also, study the examples which come with
JBuilder: they are in the samples folder,
specifically in the folders named DataExpress,
dbSwing, and JDataStore. For example, in
the "WorkModule" class of the "Basics"
example in /samples/JDataStore/Basics" folder,
look at the "openJDBCConnection()" method.
It quite clearly shows you how to go about
this.
Note that the driver is in the JDataStore
library. If the notion of library is new
to you, please read the on-line documentation
which comes with JBuilder -- it is your friend
and it is available from the "Help" menu in the
IDE.
--
Paul Furbacher (TeamB)
Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
 

Re: Getting started

By W2000 I mean Windows 2000. There are ODBC drivers that come with
W2000 which can be used to read Paradox, Access, Excel, dBase, etc.
files. I had the impression that I could name a driver I want to use in
the Driver string for the setConnection. But I don't know what to put
there. I am trying to use the BasicApp in the Database sample to teach
myself how to use JBuilder with respect to databases. I need to convert
some Paradox databases to Datastore. Paradox allows SQL queries via ODBC
so I'd learn how to use that and JDatastore to write the new
database. I cannot decode how the naming convention works. Is there
something in the registry that I have to find?
I have also looked through the newsgroups and find little on using ODBC.
Jochen
Paul Furbacher [TeamB] writes:
Quote
Jochen Haber writes:

>I am just getting started. To teach myself, I am trying to write a
>little app to convert some Paradox databases to Datastore. I am trying
>to use setConnection. What do I put in Driver String in order to use a
>W2000 ODBC driver or am I going about this in the wrong way?


It's not clear as to which database you are trying
to connect to: Paradox or JDataStore? And what
is "W2000"?

You mention ODBC, so I get the feeling that you
are trying to connect to the Paradox database.
I'm not sure that is possible, but since I have
never worked with Paradox, I am only going by
what research I can do -- that is, a search
of the newsgroup archives reveals that only
a Type 3 JDBC driver is available for Paradox.
(You don't really want to go there.)

If you mention ODBC with respect to JDataStore --
"danger Will Robinson!" -- don't do that. I repeat:
DO NOT use an ODBC driver!

Use the JDataStore Type 4 JDBC driver which comes
with JBuilder.


Also, study the examples which come with
JBuilder: they are in the samples folder,
specifically in the folders named DataExpress,
dbSwing, and JDataStore. For example, in
the "WorkModule" class of the "Basics"
example in /samples/JDataStore/Basics" folder,
look at the "openJDBCConnection()" method.
It quite clearly shows you how to go about
this.

Note that the driver is in the JDataStore
library. If the notion of library is new
to you, please read the on-line documentation
which comes with JBuilder -- it is your friend
and it is available from the "Help" menu in the
IDE.


 

Re: Getting started

Jochen Haber writes:
Quote
By W2000 I mean Windows 2000.
I think the conventional acronym for Windows 2000
is Win2K. It might help to adopt that in future
correspondence. (However, maybe in Europe it's
different.) Similarly, WXP wouldn't connote
Windows XP, whereas Windows XP would.
Quote
There are ODBC drivers that come with
W2000 which can be used to read Paradox, Access, Excel, dBase, etc.
files. I had the impression that I could name a driver I want to use in
the Driver string for the setConnection.
If you are going to use an ODBC connection, you
should use the JDBC-ODBC driver. But I have
to ask why fool around with this, when what
you want to learn is JDataStore and JDBC?
The general pattern for the URL is
jdbc:odbc:<name of ODBC DSN>
Again, use the power of the examples:
./samples/DataExpress/JDBCBenchmark
See the "connect()" method and all of
the references it invokes in
src/com/borland/samples/dx/benchmark/JDBCBenchmark.java
Note the "new ConnectionDescriptor()" call.
Follow that into "getDriver()", "getUrl()", and
so on. (You should be able to root around like
this on your own. JBuilder empowers you to do
this. Just open the projects and start digging.
If you don't know how to dig, read the manual.
It's really essential to empower yourself in these
ways.)
Quote
But I don't know what to put
there. I am trying to use the BasicApp in the Database sample to teach
myself how to use JBuilder with respect to databases.
Okay, but you are availing yourself of just
the tip of the iceberg. The creative mind
searches tirelessly (via Search>Search in Path>
Specified directory: ...) for things like "odbc".
Again, empower yourself by reading the manual,
being clever with searches, and so on.
Quote
I need to convert
some Paradox databases to Datastore. Paradox allows SQL queries via ODBC
so I'd learn how to use that and JDatastore to write the new
database. I cannot decode how the naming convention works. Is there
something in the registry that I have to find?
No, in general, forget the registry when it
comes to Java.
Quote
I have also looked through the newsgroups
and find little on using ODBC.
Yes, because it is a flawed approach, as I alluded
to in the previous message. You should have at
least noticed that just about any mention of
JDBC ODBC in the archives contains a warning
against using it.
Why do you need to query the Paradox database if you
are going to work with JDataStore? Do you need
to transfer existing data? If so, there are
easier ways to do this than writing Java code.
There's a package called PxTools which will
help you do this. Once you get the sql scripts
you need, create that JDataStore db and import
the data. Here are two URLs for PXTools:
jan.kneschke.de/projects/pxtools/
sourceforge.net/projects/pxtools/
If this is a learning exercise, just concentrate
on designing your database in JDataStore, and
accessing it using the JDataStore JDBC driver.
I would avoid trying to write code which opens
your Paradox stuff and then writes it to the
new JDataStore db. You can probably spend your
time more fruitfully.
Also, get comfortable with DB Pilot in the Tools
menu. Connecting to databases, testing the
connection, executing raw SQL, and so on from
DB Pilot can be of great value.
--
Paul Furbacher (TeamB)
Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
 

Re: Getting started

Thanks for all of that.
You miss the point slightly in that I am trying to teach myself how to
connect to existing databases. Paradox is SQL enabled and then I would
expect that an ODBC driver for Paradox databases should work just fine.
If not, then maybe Java is not right for what I want to do if it does
not access databases via vanilla ODBC. The simple question still is: How
do I nominate an arbtirary driver in the setConnection. How does the
prefixing alias jdbc:odbc: actually work?
You also underestimate the amount of rooting around that I am doing.
Nobody seems so mention why ODBC is a bad idea. Maybe it is something
parochial about Java.
Paul Furbacher [TeamB] writes:
Quote
Jochen Haber writes:

>By W2000 I mean Windows 2000.


I think the conventional acronym for Windows 2000
is Win2K. It might help to adopt that in future
correspondence. (However, maybe in Europe it's
different.) Similarly, WXP wouldn't connote
Windows XP, whereas Windows XP would.

>There are ODBC drivers that come with W2000 which can be used to read
>Paradox, Access, Excel, dBase, etc. files. I had the impression that I
>could name a driver I want to use in the Driver string for the
>setConnection.


If you are going to use an ODBC connection, you
should use the JDBC-ODBC driver. But I have
to ask why fool around with this, when what
you want to learn is JDataStore and JDBC?

The general pattern for the URL is

jdbc:odbc:<name of ODBC DSN>

Again, use the power of the examples:

./samples/DataExpress/JDBCBenchmark

See the "connect()" method and all of
the references it invokes in

src/com/borland/samples/dx/benchmark/JDBCBenchmark.java

Note the "new ConnectionDescriptor()" call.
Follow that into "getDriver()", "getUrl()", and
so on. (You should be able to root around like
this on your own. JBuilder empowers you to do
this. Just open the projects and start digging.
If you don't know how to dig, read the manual.
It's really essential to empower yourself in these
ways.)


>But I don't know what to put there. I am trying to use the BasicApp in
>the Database sample to teach myself how to use JBuilder with respect
>to databases.


Okay, but you are availing yourself of just
the tip of the iceberg. The creative mind
searches tirelessly (via Search>Search in Path>
Specified directory: ...) for things like "odbc".
Again, empower yourself by reading the manual,
being clever with searches, and so on.

>I need to convert some Paradox databases to Datastore. Paradox allows
>SQL queries via ODBC so I'd learn how to use that and JDatastore
>to write the new database. I cannot decode how the naming convention
>works. Is there something in the registry that I have to find?


No, in general, forget the registry when it
comes to Java.

>I have also looked through the newsgroups and find little on using ODBC.


Yes, because it is a flawed approach, as I alluded
to in the previous message. You should have at
least noticed that just about any mention of
JDBC ODBC in the archives contains a warning
against using it.

Why do you need to query the Paradox database if you
are going to work with JDataStore? Do you need
to transfer existing data? If so, there are
easier ways to do this than writing Java code.
There's a package called PxTools which will
help you do this. Once you get the sql scripts
you need, create that JDataStore db and import
the data. Here are two URLs for PXTools:

jan.kneschke.de/projects/pxtools/

sourceforge.net/projects/pxtools/


If this is a learning exercise, just concentrate
on designing your database in JDataStore, and
accessing it using the JDataStore JDBC driver.
I would avoid trying to write code which opens
your Paradox stuff and then writes it to the
new JDataStore db. You can probably spend your
time more fruitfully.

Also, get comfortable with DB Pilot in the Tools
menu. Connecting to databases, testing the
connection, executing raw SQL, and so on from
DB Pilot can be of great value.


 

Re: Getting started

In <XXXX@XXXXX.COM>Jochen Haber writes:
Quote
You miss the point slightly in that I am trying to teach myself how to
connect to existing databases. Paradox is SQL enabled and then I would
expect that an ODBC driver for Paradox databases should work just fine.
If not, then maybe Java is not right for what I want to do if it does
not access databases via vanilla ODBC. The simple question still is:
How do I nominate an arbtirary driver in the setConnection. How does
the prefixing alias jdbc:odbc: actually work?

Java uses a URL syntax for most all things.. (universal and flexible)
Your driver must be in the classPath.. from there the DriverManager uses
your "URL" to locate the correct driver class and load that class. You
can have multiple drivers loaded and it is the DriverManagers
responsibility to determine with driver is appropriate for the requested
database. Hence your "URL" must provide sufficient information to it to
make that determination..
(i.e. you need to study JDBC if you are going to make any progress in
this area..)
Quote
Nobody seems so mention why ODBC is a bad idea. Maybe it is something
parochial about Java.
There is nothing wrong with ODBC, it is a database connectivity API.
Unfortunately it is largely Windows specific (though It is now being
ported to other platforms.. which is good..) Java has a database
connectivity API as well and it is call JDBC.. It mirrors in many ways
ODBC in structure but with a key differnce.. it is designed by default
to be cross platform. (Which of course is one of the key issues for Java
itself, go figure..<G>)
Now where does the leave you..?? Well there is the JDBC-ODBC bridge
supplied by Sun which was designed originally as a "demo" of the concept
of using JDBC to bridge to ODBC on those platforms that have an
established ODBC protocol. (i.e. Windows) This bridge is strictly a
"demo" and should not be used for any servious db work. There are third
party bridges, and that is were you should look if you insist on using
ODBC,, but my recommendation is that you use JDBC.. There are many
drivers out there, and a number of them are open source or free from the
db vendor, there is also a very active third party source for quality
drivers.. But no matter how you cut the cake you will need to learn
JDBC..
John..
--
=============================================
TeamB are volunteer helpers. Please DO NOT REPLY VIA EMAIL!
Post all questions and replies to this newsgroup ONLY
For papers on DataExpress, Applets, JSP, and Web Development go to:
www.microps.com/mps/papers.html
====================================================
 

Re: Getting started

John B. Moore (TeamB) writes:
Quote
Now where does the leave you..?? Well there is the JDBC-ODBC bridge
supplied by Sun which was designed originally as a "demo" of the concept
of using JDBC to bridge to ODBC on those platforms that have an
established ODBC protocol. (i.e. Windows) This bridge is strictly a
"demo" and should not be used for any servious db work. There are third
party bridges, and that is were you should look if you insist on using
ODBC,, but my recommendation is that you use JDBC.. There are many
drivers out there, and a number of them are open source or free from the
db vendor, there is also a very active third party source for quality
drivers.. But no matter how you cut the cake you will need to learn
JDBC..

For examples, Easysoft makes a production-class JDBC-ODBC Bridge driver.
www.easysoft.com/products/2003/main.phtml
--
Regards,
Lori Olson (TeamB)
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
www.google.ca/advanced_group_search
Other Newsgroup Searches:
www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
www.visi.com/~gyles19/fom-serve/cache/1.html
 

Re: Getting started

I have just purchased C++ Borland 6, personal. I have never used this software. I am familiar with C++ coding in an older version of Borland as well as in CodeWarrior. Could someone please tell me how to get started. I just need to code a simple program with one .cpp file. I have found how to open a .cpp file and to enter code. I can not however get any output to show. Please help!
 

Re: Getting started

"Casey" <XXXX@XXXXX.COM>writes
Quote

I have just purchased C++ Borland 6, personal. I have never used this
software. I am familiar with C++ coding in an older version of Borland as
well as in CodeWarrior. Could someone please tell me how to get started. I
just need to code a simple program with one .cpp file. I have found how to
open a .cpp file and to enter code. I can not however get any output to show.
Please help!
File>New>Other>Console Wizard
Check C++ ,Check Use CLX , Check Console App, then OK
You should now be presented with a partially completed C++ file.
Paste the following over it.
//--------------------------------------------------------------------------
-
#include <clx.h>
#pragma hdrstop
//--------------------------------------------------------------------------
-
#pragma argsused
#include <iostream>
#include <conio>//for getch()
using namespace std;
int main(int argc, char* argv[])
{
cout <<"Hello" << endl;
getch();//prevents output from flashing by.
return 0;
}
//--------------------------------------------------------------------------
-
 

Re: Getting started

"Michael Harrington" <XXXX@XXXXX.COM>writes:
Quote

"Casey" <XXXX@XXXXX.COM>writes
news:40870635$XXXX@XXXXX.COM...
>
>I have just purchased C++ Borland 6, personal. I have never used this
software. I am familiar with C++ coding in an older version of Borland as
well as in CodeWarrior. Could someone please tell me how to get started. I
just need to code a simple program with one .cpp file. I have found how to
open a .cpp file and to enter code. I can not however get any output to show.
Please help!

File>New>Other>Console Wizard
Check C++ ,Check Use CLX , Check Console App, then OK
You should now be presented with a partially completed C++ file.
Paste the following over it.
//--------------------------------------------------------------------------
-

#include <clx.h>
#pragma hdrstop

//--------------------------------------------------------------------------
-

#pragma argsused
#include <iostream>
#include <conio>//for getch()
using namespace std;
int main(int argc, char* argv[])
{
cout <<"Hello" << endl;
getch();//prevents output from flashing by.

return 0;
}
//--------------------------------------------------------------------------
-



I am unable to check Use CLX. Now what do I do?
 

Re: Getting started

Quote
I am unable to check Use CLX. Now what do I do?
change
Quote
>File>New>Other>Console Wizard
>Check C++ ,Check Use CLX , Check Console App, then OK
to
File>New>Other>Console Wizard
Check C++ ,UNCheck Use CLX and Use VCL,
Check Console App, then OK
------------------------------
#include <iostream>
#include <conio>//for getch()
using namespace std;
int main(int argc, char* argv[])
{
cout <<"Hello" << endl;
getch();//prevents output from flashing by.
return 0;
}
------------------------------
Various trivial hi world variant programs illustrating rather basic
console and GUI mode programs all of which are accompanied with either
a make file or batch file in case you also want to build from the
command line.
www.mulroy.org/hello.zip
. Ed
Quote
Casey writes
news:40872575$XXXX@XXXXX.COM...
 

Re: Getting started

"Ed Mulroy [TeamB]" <XXXX@XXXXX.COM>writes:
Quote
>I am unable to check Use CLX. Now what do I do?

change

>>File>New>Other>Console Wizard
>>Check C++ ,Check Use CLX , Check Console App, then OK


to

File>New>Other>Console Wizard
Check C++ ,UNCheck Use CLX and Use VCL,
Check Console App, then OK

------------------------------
#include <iostream>
#include <conio>//for getch()
using namespace std;
int main(int argc, char* argv[])
{
cout <<"Hello" << endl;
getch();//prevents output from flashing by.

return 0;
}

------------------------------

Various trivial hi world variant programs illustrating rather basic
console and GUI mode programs all of which are accompanied with either
a make file or batch file in case you also want to build from the
command line.

www.mulroy.org/hello.zip

. Ed

>Casey writes
>news:40872575$XXXX@XXXXX.COM...


I believe that is what I ended up doing. I got it to work though. I know from now on I need to open the console wizard. There is just one part I am not familiar with on this code. It is the #pragma hdrstop and the #pragma argsused. And of course the two arguments that are passed through main. I have never had to use this notation. Could you explain? Thanks.
 

Re: Getting started

#pragma hdrstop
A result of the number and complexity of header files used in a C++
language compilation is that significant time is spent processing
them. As a solution the compiler pre-compiles header files into a
form which can be quickly processed. As a consequence of this an
image of each header file set and ordering found in the entire project
must be kept in the precompiled file. Such multiple sets can lead to
diminishing returns and even to compile times that compare unfavorably
with if they were not used.
The method used to avoid this is to use #pragma hdrstop to mark for
the compiler the line at which the precompiled header process should
end. Files which are included after that pragma will not be involved
in that process.
#pragma argsused
When a calling argument to a function is not used the compiler issues
a warning. If you wish to suppress such warnings then place #pragma
argsused on the line immediately preceding the function.
pragmas in general
Pragmas are a method specified by both the C and C++ language
standards for setting compiler specific options.
Click Help in the IDE's menu. Choose C++ Builder help. If an index
it is not shown, click on the Index tab. Enter the word pragma into
the edit control and click the Display button to get to a page which
describes the available pragmas and their meanings.
calling arguments to the function main
The function main is where all console mode and standard C or C++
programs begin processing. It is pre-declared.
It can be expressed as having no arguments, one argument of the type
int which is commonly called argc and is command line argument count,
two arguments, argc plus a char** command line argument value array
commonly called argv or possibly more arguments as an allowed but
compiler-specific item.
It might be worthwhile to read a bit about C++. This page has links
to tutorials, language standards and people's pages where help on the
C and C++ languages can be found.
www.mulroy.org/programg.htm
. Ed
Quote
Casey writes
news:4087303a$XXXX@XXXXX.COM...

There is just one part I am not familiar with on this
code. It is the #pragma hdrstop and the #pragma
argsused. And of course the two arguments that
are passed through main. I have never had to use
this notation. Could you explain? Thanks.