473,411 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

database access

112 100+
i have read all about accessing databases through things like mySQL, but one thing i dont understand is how to access/create an actual database on the users hard drive...is there a way to create some kind of database without using sql or anything with queries and stuff like that?


thanks alot,
ken
Mar 24 '08 #1
16 2442
sukatoa
539 512MB
i have read all about accessing databases through things like mySQL, but one thing i dont understand is how to access/create an actual database on the users hard drive...is there a way to create some kind of database without using sql or anything with queries and stuff like that?


thanks alot,
ken
Do you mean creating/Accessing the file? If this is,

Yes you can... you can implement it in java.... File Handling... I/O classes
Actually it is already complex for me when implemented...

String handling is also very important when comparing values with ignoring cases/hint type search...

Since database is structured like a table, with columns and rows...When using MySQLControlCenter...

You can do it in multidimensional array implementation....
Very long if you would try.... ( For me )....
You can implement it like queryString pass type implementation.. ( pass to a parameter then filter )... or depends on you... ( How will you going to use them )...

For me, the SQL, Oracle or whatsoever database handler are they, they were design to simplify storing datas to a file and would eliminate hardcoded implementation for storing datas.... Specially with very huge number of datas...

but, if for experimenting, you will enjoy it....

Correct me if im wrong,
sukatoa
Mar 24 '08 #2
drsmooth
112 100+
well i would like to handle it sort of like a microsoft access databse...it has the columns and rows and its not hardcoded but isnt virtual or on a server either
Mar 24 '08 #3
drsmooth
112 100+
i guess the heart of my question is...i need to know how to create/read/write to and from a database file on the hard drive...
Mar 26 '08 #4
sukatoa
539 512MB
i guess the heart of my question is...i need to know how to create/read/write to and from a database file on the hard drive...
Can you post the content of your database file?
Let see if we can get some patterns from it......

update us,
sukatoa
Mar 27 '08 #5
JosAH
11,448 Expert 8TB
Note that starting from Java 1.6 it comes with a relational database; it's named
'Derby' and is written in Java itself and has quite a small footprint. The dbms
comes with its own documentation and works fine.

I accidentally stumbled on this thing by reading some Sun propaganda and it
surprised me because of Sun's recent acquisition of MySQL but nevertheless
Derby works fine. Derby has an 'embedded' single user driver as well as a
multi user 'server' driver. Both can be used using ordinary JDBC method calls.

If you read the ample documentation it's easy to get started with it within a
couple of minutes, i.e. create a database and one of more schemas and add
tables, views and stored procedures (which must be written in Java as well).
Derby even supports triggers; normal SQL ISO/1992 and further is supported.
IMHO it's a fairly complete dbms.

kind regards,

Jos
Mar 27 '08 #6
drsmooth
112 100+
ok well i havent quite made the database yet but its going to be used to store AI characters and their traits, basically a name, id number and a pile of traits is what i need, but i need it stored in a real tangible file can derby do that?...if derby can do that ill def look into it...im very new to even the idea of using databases so excuse my lack of formality on this
Mar 27 '08 #7
JosAH
11,448 Expert 8TB
ok well i havent quite made the database yet but its going to be used to store AI characters and their traits, basically a name, id number and a pile of traits is what i need, but i need it stored in a real tangible file can derby do that?...if derby can do that ill def look into it...im very new to even the idea of using databases so excuse my lack of formality on this
Sure, Derby can do that; it's a fully operational database manager not just a
file handler. You can define your table(s) using JDBC and indexes for it if you
need some as well as primary keys etc. etc. etc.

Your can insert/delete and update rows of tables using the same JDBC interface.
The query language is regular SQL with its extensions (as all dbms-es have).

The data of the database is stored in ordinary (binary) files. What more do you want?

Just a little while ago I found out that it even existed and now I use it for a persistency
layer for my own private language/environment RPL: objects from that system
are stored and retrieved to/from that database whenever I want.

kind regards,

Jos
Mar 27 '08 #8
drsmooth
112 100+
yea okay...that sounds perfect. i noticed you said u stored objects...could i store and load actual java class objects?
Mar 27 '08 #9
JosAH
11,448 Expert 8TB
yea okay...that sounds perfect. i noticed you said u stored objects...could i store and load actual java class objects?
Sure you can: define a column as type blob (db jargon for Binary Large OBject).
You can open Input- and OutputStreams from/to it and wrap those streams in
ObjectInput- and ObjectOutputStreams and read/write your Serializable objects
from/to it. That's all there is to it, all those persistency frameworks use it all the
time.

kind regards,

Jos
Mar 27 '08 #10
drsmooth
112 100+
wow ok...that will be very helpful...when i get up to that step of my program, hopefully it will b as easy as it seems lol
Mar 27 '08 #11
drsmooth
112 100+
ive been readin through the tutorial on the sun site and ive looked at the sample code but i havent been able to get rid of this error i get at runtime:

java.sql.SQLTransientConnectionException: Database 'TTGDB' shutdown.

anyone know what that means???

if you want to see my code i could post it, but im jus lookin for an explanation as to what that means
Mar 30 '08 #12
JosAH
11,448 Expert 8TB
ive been readin through the tutorial on the sun site and ive looked at the sample code but i havent been able to get rid of this error i get at runtime:

java.sql.SQLTransientConnectionException: Database 'TTGDB' shutdown.

anyone know what that means???

if you want to see my code i could post it, but im jus lookin for an explanation as to what that means
You can't get rid of that as the documentation states: whenever you close a
database Derby throws an exception after (successfully) closing the database.
It's a bit strange but all you have to do is try { ... } catch the exception; that's
the way Derby does it, I don't know why; it must've something to do that they
want that close operation to end up in their log file.

kind regards,

Jos
Mar 30 '08 #13
drsmooth
112 100+
ok, also it says ...11 more at the end of that exception...how do i show all of those?
Mar 30 '08 #14
JosAH
11,448 Expert 8TB
ok, also it says ...11 more at the end of that exception...how do i show all of those?
Yech, you don't want to see them ;-) If you must, have a look at the Throwable
class; it's the mother of all Exceptions and Errors and pay special attention to
its getCause() and getStackTrace() methods.

But again: you get that Exception when a database has been successfully closed;
so why bother?

kind regards,

Jos
Mar 30 '08 #15
drsmooth
112 100+
because the output doesnt seem to be working correctly...also a new exception comes up before the closing DB exception:

Expand|Select|Wrap|Line Numbers
  1. java.sql.SQLSyntaxErrorException: Lexical error at line 1, column 33.  Encounter
  2. ed: "\u2019" (8217), after : "".
  3.         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknow
  4. n Source)
  5.         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransport
  6. AcrossDRDA(Unknown Source)
  7.         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unkn
  8. own Source)
  9.         at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source
  10. )
  11.         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException
  12. (Unknown Source)
  13.         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Un
  14. known Source)
  15.         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown So
  16. urce)
  17.         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown So
  18. urce)
  19.         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
  20.         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
  21.         at DataBaseReader.main(DataBaseReader.java:25)
  22. Caused by: java.sql.SQLException: Lexical error at line 1, column 33.  Encounter
  23. ed: "\u2019" (8217), after : "".
  24.         ... 11 more
  25. Press any key to continue...
  26.  
Mar 30 '08 #16
drsmooth
112 100+
actually it seems the tutorial i copied it from used a wierd form of single quote...i fixed the problem thanks for all youre help...im gonna try and help out the begginer-ish questions on this forum if i can...im quite a noob myself though :(

im off to work on writing objects to the DB, hopefully i wont be starting any threads soon lol
Mar 31 '08 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Sarah Tanembaum | last post by:
I was wondering if it is possible to create a secure database system using RDBMS(MySQL, Oracle, SQL*Server, PostgreSQL etc) and web scripting/programming language(Perl, PHP, Ruby, Java, ASP, etc)...
3
by: cooldv | last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and Access 2000 database. (with a hosting company) traffic is slow at this time but expect to grow. lately i have been reading...
10
by: MHenry | last post by:
Hi, We were going merrily along for 6 years using this database to record all client checks that came into our office, including information about what the checks were for. Suddenly, network...
5
by: premmehrotra | last post by:
I currently have a multi-user access database which is put on a shared drive L: on a Windows Servers. Entire database is one file premdb.mdb. Users access this database from their laptops....
8
by: John Baker | last post by:
Hi: I am URGENTLY in need of some book or web site OR tool that will help me integrate a relatively simple access application into a web page or pages. This is a time recording system (by...
1
by: Claus Haslauer | last post by:
Hi, firstly, I am new to access03 and server03 Originally, I had written an access 2002 database. Then, we transferred (for another reason) to server 2003. Then, we got access 2003. Then I...
15
by: philip | last post by:
On a form, I have a datagridview. This datagridview is constructed on a dataset filled by a tableadapter. The table adapter do very well what it must do when filling dataset. Insertions,...
7
by: Allison | last post by:
Hi -- we are a small manufacturing looking for a multi-user database to take customer orders (nothing too complicated, with 3 users total). We think we should be using Access, but are wondering...
18
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
21
by: nihad.nasim | last post by:
Hi there, I have a database in Access that I need on the web. The web page should connect to the database and write records for certain tables and view records for others. I want to know a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.