JDBC to Postgres!!!
Hi,
I have a problem with the JDBC to Postgres, my code is:
Class.forName("org.postgresql.Driver");
String url = "jdbc:postgresql://localhost/sre";
database.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor(
url, "root", "", false, "org.postgresql.Driver"));
queryDataSet1.setQuery(new
com.borland.dx.sql.dataset.QueryDescriptor(conexionBD1.getDatabase(),
"SELECT nombre FROM grupo", null, true, Load.ALL));
jdbTable1.setDataSet(queryDataSet1);
When I execute my program I've the error that said me:
" A connection error has ocurred. org.postgresql.util.PSQLException: FATAL"
What's the solution?
I using Fedora Core 2, Postgresql 7.4.2, JDBC pg74.216.jdbc3.jar, JDK 1.4.2 and Jbuilder 2005 Enterprise as IDE.
Thanks.
Was there any additional information in the error message? Might be worth posting the whole stack trace as-is.
But basically this is going to be a problem with your configuration of PostgreSQL or the machine it's running on or (if applicable) the network connection between your client and the server.
Try connecting via psql using the -h localhost option. If that doesn't work the problem is probably with your pg_hba.conf
Dave.
Similar Messages
-
Meta migration ant task throw exception
Hi,
I am trying the migration from kodo 2 to 3.
I successfully migrated the properties file using the integrated ant
task; but run into some problem with the meta data migration (the *.jdo
files). following is the ant task I am using:
<target name="migrate-meta" depends="init, prepare-jdo-meta, compile" >
<!-- define the kodo2migrator task; this can be done at the top
of -->
<!-- the build.xml file, so it will be available for all
targets -->
<taskdef name="kodo2migrator"
classname="kodo.jdbc.ant.Kodo2MigratorTask">
<classpath>
<pathelement
path="${java.class.path}:${project.classpath}:${project.build.jdometa.dtd}"/>
</classpath>
</taskdef>
<!-- invoke migrator on all .jdo files below the src directory -->
<kodo2migrator>
<classpath>
<pathelement
path="${java.class.path}:${project.classpath}:${project.build.jdometa.dtd}"/>
</classpath>
<fileset dir="${project.kodo.src}">
<include name="**/*.jdo" />
</fileset>
<config properties="${jdo.properties}" />
</kodo2migrator>
</target>
the exception it is throwning is :
[kodo2migrator] kodo.jdbc.migration.kodo2.util.FatalUserException: The
specified driver class "null" is neither a java.sql.Driver nor a
javax.sql.DataSource. Please specify a valid driver in the
javax.jdo.option.ConnectionDriverName property.
[kodo2migrator] at
kodo.jdbc.migration.kodo2.schema.ConfigurationConnector.createConnectionFactory(ConfigurationConnector.java:108)
[kodo2migrator] at
kodo.jdbc.migration.kodo2.schema.ConfigurationConnector.<init>(ConfigurationConnector.java:65)
[kodo2migrator] at
kodo.jdbc.migration.kodo2.schema.ConfigurationConnector.<init>(ConfigurationConnector.java:57)
[kodo2migrator] at
kodo.jdbc.migration.kodo2.schema.ConfigurationConnector.<init>(ConfigurationConnector.java:37)
[kodo2migrator] at
kodo.jdbc.migration.kodo2.Kodo2Migrator.migrate(Kodo2Migrator.java:161)
[kodo2migrator] at
kodo.jdbc.migration.kodo2.Kodo2Migrator.run(Kodo2Migrator.java:1141)
[kodo2migrator] at
kodo.jdbc.ant.Kodo2MigratorTask.executeOn(Kodo2MigratorTask.java:53)
[kodo2migrator] at
com.solarmetric.ant.TaskBase.execute(TaskBase.java:105)
[kodo2migrator] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
[kodo2migrator] at org.apache.tools.ant.Task.perform(Task.java:341)
[kodo2migrator] at
org.apache.tools.ant.Target.execute(Target.java:309)
[kodo2migrator] at
org.apache.tools.ant.Target.performTasks(Target.java:336)
[kodo2migrator] at
org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[kodo2migrator] at
org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[kodo2migrator] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[kodo2migrator] at org.apache.tools.ant.Main.start(Main.java:196)
[kodo2migrator] at org.apache.tools.ant.Main.main(Main.java:235)
BUILD FAILED
file:/home/tyang/eclipse/workspace/UMA/build.xml:208:
kodo.jdbc.migration.kodo2.util.FatalUserException: The specified driver
class "null" is neither a java.sql.Driver nor a javax.sql.DataSource.
Please specify a valid driver in the
javax.jdo.option.ConnectionDriverName property.
the properties file I am using is like this: (just a snipet)
javax.jdo.PersistenceManagerFactoryClass:
kodo.jdbc.runtime.JDBCPersistenceManagerFactory
javax.jdo.option.ConnectionDriverName: org.postgresql.Driver
javax.jdo.option.ConnectionURL: jdbc:postgresql://127.0.0.1/cwdevdb
javax.jdo.option.ConnectionUserName: cwdev
javax.jdo.option.ConnectionPassword:
javax.jdo.option.DefaultFetchBatchSize: 10
javax.jdo.option.DefaultFetchThreshold: 30
javax.jdo.option.IgnoreCache: true
javax.jdo.option.NontransactionalRead: true
javax.jdo.option.NontransactionalWrite: false
javax.jdo.option.Optimistic: true
javax.jdo.option.RestoreValues: false
javax.jdo.option.RetainValues: false
kodo.ConnectionFactoryProperties: MaxActive=20, MaxWait=5000
kodo.ConnectionRetainMode: persistence-manager
kodo.DataCache: true(CacheSize=10000)
kodo.LicenseKey: xxxx-xxxx-xxxx-xxxx-xxxx
kodo.ManagedRuntime: TransactionManagerName=java:/TransactionManager
kodo.PersistenceManagerImpl: CloseOnManagedCommit=true
kodo.QueryCache: true
kodo.RemoteCommitProvider: sjvm(Topic=topic/KodoCacheTopic)
kodo.jdbc.DBDictionary: postgres(StoreCharsAsNumbers=false)
kodo.jdbc.SequenceFactory: PrimaryKeyColumn=PKX,
SequenceColumn=SEQUENCEX, TableName=JDO_SEQUENCEX
To make sure this IS the one it is using, not only I echo out the
"${jdo.properties}" value, but also I tried to comment out the
licenseKey line, then it threw "license key invalid" exception. so I am
sure this is the properties file I am using in that ant task.
Also I tried using the command line on one of our classes, it does not
run into this problem.
Any clue what I am missing?
Thanks a lot,
TaoThe 3.0.0 migrator task has a couple of bugs. These will be ironed out
in 3.0.1, which is due for release any day now. But if you must work
around the bugs immediately, you'll have to:
1. Run the task using your old properties file. Actually this will be a
requirement even in 3.0.1; that's why in the migration chapter of the
docs we say to migrate your metadata before your properties. The
migration tool needs to access 2.5 properties to map your classes properly.
2. Add the the following property to your old properties file:
kodo.LicenseKey: <your license key>
3. Name the properties file "kodo.properties" and place it in one of the
directories listed in the ant task's CLASSPATH. If that doesn't work,
place it in a directory in your system CLASSPATH. The 3.0.0 task has
some classpath problems, and also the <config> task element doesn't work.
Or, you could just set your system CLASSPATH and run the kodo2migrator
tool from the command line.
I hope this helps. As I said, 3.0.1 resolves these ant problems, and
will be released very shortly. -
Set database dictionary in Mappingtool Ant Task
Hi,
I'm sure I'm not the only person that uses the MappingTool Ant task to
create SQL DDL, so why isn't there a way to tell it to use the correct
database
dictionary? When I run the ant task, the SQL producted is incorrect for my
database type.
I've checked the MappingTookTask.java file and I can that
JDBCConfiguration has a setter method to set the dictionary, but I can't
see how I would add this as a parameter to my Ant Task.
I've added
kodo.jdbc.DBDictionary=postgres
to my kodo.properties file but this doesn't seem to be used by the ant
task.
So for the momement I'm falling back on a sed script to correct the SQL
(i.e. int8(8) to int8, etc), but this is hardly ideal.
Thanks,
Andy.Abe White wrote:
Could it be that Kodo is in fact using the right dictionary, but is just
issuing bad SQL? What version of Kodo are you using? And what exactly
are the symptoms of the problem? The use of type names like int8(8)?
Is that generated for an existing database column, or a new one Kodo is
creating?Something strange is happening because my other Ant tasks, including a
mapping tool task that creates the database tables works fine.
Here is how I call the task that creates the schema file -
<pre>
<mappingToolTask action="refresh" sqlfile="${sql.schema.file}"
schemaaction="build">
<fileset dir="${project.src.dir}">
<include name="**/*.jdo" />
</fileset>
</mappingToolTask>
</pre>
Here is how I call the task that creates the database tables -
<pre>
<mappingToolTask action="${param.action}">
<fileset dir="${project.src.dir}">
<include name="**/*.jdo" />
</fileset>
</mappingToolTask>
</pre>
As you can see only only differnce between the two tasks is the sqlfile
and schemaaction properties - it is as if the code that writes the schema
file does use the same dictionary logic as when the database tables are
created.
Th error manifests itself as incorrect data types (for PostgreSQL). I get
int(8) instead of int8, etc. Currently I correct this as follows -
line = line.replaceAll("int8\\(8\\)","int8");
line = line.replaceAll("int4\\(4\\)","int4");
line = line.replaceAll("timestamp\\(8\\)","timestamp");
line = line.replaceAll("bigserial\\(8\\)","bigserial");
line = line.replaceAll("bool\\(1\\)","boolean");
line = line.replaceAll("text\\(-1\\)","text");
line = line.replaceAll("float8\\(8\\)","float8");
I'm using 3.3.4.
Andy. -
Kodo.util.DataStoreException: Backend start-up failed: FATAL
when we do one test which concurrent users number is 800, there will cause
following exception:
kodo.util.DataStoreException: Backend start-up failed: FATAL: Sorry, too
many clients already
would you tell me what will cause the exception? and how to support more
concurrent users?yes, this is my configure error.
when we reduce the MaxActive number(kodo db con pool size must smaller
then the allowed DB connections number), then the error not happen.
thanks a lot.
Marc Prud'hommeaux wrote:
Is your database configured to allow 200 simultaneous connections (as
you have specified in the "MaxActive=200" parameter of the
"kodo.ConnectionFactoryProperties" property)? If not, can you reduce
this number down to the maximum allowed by your database, and let us
know if the error still happens?
In article <[email protected]>, flamingo wrote:
kodo.properties as following:
# Database connection properties
javax.jdo.option.ConnectionDriverName=org.postgresql.Driver
javax.jdo.option.ConnectionUserName=xxx
javax.jdo.option.ConnectionPassword=xxx
javax.jdo.option.ConnectionURL=jdbc:postgresql://localhost/skillsdb
javax.jdo.option.Optimistic=true
javax.jdo.option.RetainValues=false
javax.jdo.option.RestoreValues=false
javax.jdo.option.NontransactionalRead=true
javax.jdo.option.NontransactionalWrite=false
javax.jdo.option.IgnoreCache=true
javax.jdo.PersistenceManagerFactoryClass=kodo.jdbc.runtime.JDBCPersistenceManagerFactory
>>
kodo.LicenseKey=xxx
kodo.ConnectionFactoryProperties=MaxCachedStatements=0, MaxActive=200,
MaxWait=5000, TestOnBorrow=true, ValidationSQL="SELECT GETDATE()"
kodo.ConnectionRetainMode=transaction
kodo.DataCache=true(CacheSize=10000)
kodo.QueryCache=true(CacheSize=5000)
#kodo.FlushBeforeQueries=true
kodo.RemoteCommitProvider=sjvm
kodo.ManagedRuntime=TransactionManagerName=java:/TransactionManager
kodo.PersistenceManagerImpl=EvictFromDataCache=true
kodo.jdbc.DBDictionary=postgres(StoreCharsAsNumbers=false)
kodo.jdbc.MappingFactory=metadata
kodo.jdbc.SchemaFactory: file(FileName=schema.xml)
kodo.jdbc.SequenceFactory=PrimaryKeyColumn=PKX, SequenceColumn=SEQUENCEX,
TableName=JDO_SEQUENCEX
and I check codes, we had closed all extent iterators, query results, PMs,
etc.
thanks a lot.
Abe White wrote:
There aren't any nested exceptions? That's the only trace you see?
In any case, the message is from your JDBC driver, which is probablyrelaying it
directly from your database. It is not a Kodo error message; Kodo is
only
wrapping the SQLException in a subclass of JDOException. As Patricksuggested,
the error probably means that your database can't handle the number ofclients
you're throwing at it. One possible reason for this is that you aren'tfreeing
up connections. Can you post your kodo.properties? Under default
settings
Kodo
doesn't hold onto database connections much, but under certain settings
it
becomes more important to remember to close your extent iterators, query
results, PMs, etc.
Marc Prud'hommeaux
SolarMetric Inc. -
Signed applet and database connetion...
Hello,
Well, I am deploying an applet application which needs to connect with a postgres database.
I put my application in my hosting then I changed my local java.policy file adding a line as
permission java.net.SocketPermission "127.0.0.1:5432", "connect,resolve";And my applet works... but I don't want that the user needs to change his policies file.
I read in somewhere in the forum if the applet is signed the user doesn't need to change anything... then I sign the applet. But it doesn't work. It looks to me that signing the applet is not enough to allows the connection.
But I don't sure.
Some body had had the same problem or am I doing some thing wrong?? Other Ideas
By the way, sorry for my bad english, I hope you can understand what I am saying.
Bye, and thanks by advance4NDR01D3 wrote:
Thanks for the answer.
That's a good test, I put some code before the DB connection to create a file:
File file = new File("tavo.txt");
boolean success = file.createNewFile();
if (success) {
javax.swing.JOptionPane.showMessageDialog(null, "YES");
// File did not exist and was created
} else {
javax.swing.JOptionPane.showMessageDialog(null, "NO");
// File already exists
}And surprisingly it creates the file. but doesn't connect to the database.
I Sign the applet by command line, like this:
keytool -genkey -alias signFiles -keystore compstore -keypass pass -dname "cn=salazar" -storepass pass
jarsigner -keystore compstore -storepass pass -keypass pass -signedjar Sproceso.jar proceso.jar signFiles
baftos wrote:Or at least one of the classes that are on the stack when you cpnnect to the database does not come from > the signed jar.Out of the Jar are the JDBC files(postgres.jar), it could be the problem??Your JAR is signed OK and this is good.
DB connections are not prohibited as such.
What is prohibited are Socket connections, which DB connections use internally.
Therefore, if any of the classes on the stack, when the Socket connection occurs
is not from your jar, it will fail. Therefore, the 3rd party files must be all in your jar.
Technically, this is easy: explode their jar and create your jar in such a way as to contain
all the files from their jar as well. Do it just as an experiment. If it works, read well
their licensing terms, which may forbid this. If they forbid it or if in doubt, contact them. -
Postgresql qurey: string.matchs exception
Hi,
I had follwing query:
String filter = "lastName.matches('z.*')";
Query query = pm.newQuery(UserImpl.class, filter);
Collection result = (Collection) query.execute();
but when execute, it throws Exception:
[http-8080-Processor16] ERROR struts.action.AbstractModelAction -
ERROR: Invalid UNICODE character sequence found (0xc000) {prepstmnt
31782389 SELECT t0.JDOIDX, t0.JDOCLASSX, t0.JDOLOCKX, t0.email,
t0.user_enabled, t0.externalId, t0.firstName, t0.KOBJECTX, t0.lastName,
t0.loginName, t0.middleName, t0.password, t0.uri FROM TUser t0 WHERE
(t0.lastName LIKE ?) [params=(String) z%] [reused=0]} [code=0, state=null]
kodo.util.DataStoreException: ERROR: Invalid UNICODE character sequence
found (0xc000) {prepstmnt 31782389 SELECT t0.JDOIDX, t0.JDOCLASSX,
t0.JDOLOCKX, t0.email, t0.user_enabled, t0.externalId, t0.firstName,
t0.KOBJECTX, t0.lastName, t0.loginName, t0.middleName, t0.password, t0.uri
FROM TUser t0 WHERE (t0.lastName LIKE ?) [params=(String) z%] [reused=0]}
[code=0, state=null]
at
kodo.jdbc.sql.DBDictionary.newDataStoreException(DBDictionary.java:3004)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:77)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:63)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:43)
at
kodo.jdbc.runtime.SelectResultObjectProvider.handleCheckedException(SelectResultObjectProvider.java:180)
at com.solarmetric.rop.EagerResultList.<init>(EagerResultList.java:32)
at kodo.query.AbstractQuery.execute(AbstractQuery.java:1052)
at kodo.query.AbstractQuery.executeWithArray(AbstractQuery.java:836)
at kodo.query.AbstractQuery.execute(AbstractQuery.java:793)
at kodo.datacache.CacheAwareQuery.execute(CacheAwareQuery.java:314)
at
com.cloverworxs.impl.as.security.RoleBasedSecurityManagerImpl.queryUser(RoleBasedSecurityManagerImpl.java:1409)
at
com.cloverworxs.impl.as.security.RoleBasedSecurityManagerImpl.queryUser(RoleBasedSecurityManagerImpl.java:1399)
at
com.cloverworxs.impl.as.security.RoleBasedSecurityManagerImpl.queryUserByLastName(RoleBasedSecurityManagerImpl.java:1435)
at
com.cloverworxs.impl.as.security.RoleBasedSecurityManagerImpl.queryUser(RoleBasedSecurityManagerImpl.java:1372)
at
com.cloverworxs.uma.helper.UserSearchHelper.searchUser(UserSearchHelper.java:26)
at
com.cloverworxs.uma.render.UserSearchRender.prepareData(UserSearchRender.java:61)
at
com.cloverworxs.uma.fwork.UMAControllerBase.umaViewProcess(UMAControllerBase.java:423)
at
com.cloverworxs.uma.fwork.UMAControllerBase.umaStandardProcess(UMAControllerBase.java:373)
at
com.cloverworxs.app.struts.action.PortalViewController.detail(PortalViewController.java:117)
at
com.cloverworxs.app.struts.action.AbstractModelAction.execute(AbstractModelAction.java:201)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
com.cloverworxs.app.struts.RequestProcessor.process(RequestProcessor.java:113)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
com.cloverworxs.app.web.filter.EncodingFilter.doFilter(EncodingFilter.java:83)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Unknown Source)
and my kodo.properties :
kodo.ConnectionFactoryProperties: MaxActive=80, MaxWait=5000, \
TestOnBorrow=true, ValidationSQL="SELECT NOW()"
kodo.jdbc.DBDictionary: postgres(StoreCharsAsNumbers=false)
kodo.jdbc.SequenceFactory: PrimaryKeyColumn=PKX, SequenceColumn=SEQUENCEX,
TableName=JDO_SEQUENCEX
and if the filter is:lastName.matches('.*z.*'), it works well.
Thanks a lot.Thanks a lot.
We will upgrade PostgreSQL server and test it.
Marc Prud'hommeaux wrote:
It looks like this is actually a bug with PostgreSQL, according to the
following bug reports:
http://archives.postgresql.org/pgsql-bugs/2002-07/msg00030.php
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=113231
I read at http://archives.postgresql.org/pgsql-sql/2004-03/msg00259.php
that this is fixed in PostgreSQL server version 7.3.6. You may need to
upgrade to fix the problem.
flamingo wrote:
Hi,
I had follwing query:
String filter = "lastName.matches('z.*')";
Query query = pm.newQuery(UserImpl.class, filter);
Collection result = (Collection) query.execute();
but when execute, it throws Exception:
[http-8080-Processor16] ERROR struts.action.AbstractModelAction -
ERROR: Invalid UNICODE character sequence found (0xc000) {prepstmnt
31782389 SELECT t0.JDOIDX, t0.JDOCLASSX, t0.JDOLOCKX, t0.email,
t0.user_enabled, t0.externalId, t0.firstName, t0.KOBJECTX, t0.lastName,
t0.loginName, t0.middleName, t0.password, t0.uri FROM TUser t0 WHERE
(t0.lastName LIKE ?) [params=(String) z%] [reused=0]} [code=0, state=null]
kodo.util.DataStoreException: ERROR: Invalid UNICODE character sequence
found (0xc000) {prepstmnt 31782389 SELECT t0.JDOIDX, t0.JDOCLASSX,
t0.JDOLOCKX, t0.email, t0.user_enabled, t0.externalId, t0.firstName,
t0.KOBJECTX, t0.lastName, t0.loginName, t0.middleName, t0.password, t0.uri
FROM TUser t0 WHERE (t0.lastName LIKE ?) [params=(String) z%] [reused=0]}
[code=0, state=null]
at
kodo.jdbc.sql.DBDictionary.newDataStoreException(DBDictionary.java:3004)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:77)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:63)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:43)
at
kodo.jdbc.runtime.SelectResultObjectProvider.handleCheckedException(SelectResultObjectProvider.java:180)
at com.solarmetric.rop.EagerResultList.<init>(EagerResultList.java:32)
at kodo.query.AbstractQuery.execute(AbstractQuery.java:1052)
at kodo.query.AbstractQuery.executeWithArray(AbstractQuery.java:836)
at kodo.query.AbstractQuery.execute(AbstractQuery.java:793)
at kodo.datacache.CacheAwareQuery.execute(CacheAwareQuery.java:314)
at
com.cloverworxs.impl.as.security.RoleBasedSecurityManagerImpl.queryUser(RoleBasedSecurityManagerImpl.java:1409)
at
com.cloverworxs.impl.as.security.RoleBasedSecurityManagerImpl.queryUser(RoleBasedSecurityManagerImpl.java:1399)
at
com.cloverworxs.impl.as.security.RoleBasedSecurityManagerImpl.queryUserByLastName(RoleBasedSecurityManagerImpl.java:1435)
at
com.cloverworxs.impl.as.security.RoleBasedSecurityManagerImpl.queryUser(RoleBasedSecurityManagerImpl.java:1372)
at
com.cloverworxs.uma.helper.UserSearchHelper.searchUser(UserSearchHelper.java:26)
at
com.cloverworxs.uma.render.UserSearchRender.prepareData(UserSearchRender.java:61)
at
com.cloverworxs.uma.fwork.UMAControllerBase.umaViewProcess(UMAControllerBase.java:423)
at
com.cloverworxs.uma.fwork.UMAControllerBase.umaStandardProcess(UMAControllerBase.java:373)
at
com.cloverworxs.app.struts.action.PortalViewController.detail(PortalViewController.java:117)
at
com.cloverworxs.app.struts.action.AbstractModelAction.execute(AbstractModelAction.java:201)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
com.cloverworxs.app.struts.RequestProcessor.process(RequestProcessor.java:113)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
com.cloverworxs.app.web.filter.EncodingFilter.doFilter(EncodingFilter.java:83)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Unknown Source)
and my kodo.properties :
kodo.ConnectionFactoryProperties: MaxActive=80, MaxWait=5000,
TestOnBorrow=true, ValidationSQL="SELECT NOW()"
kodo.jdbc.DBDictionary: postgres(StoreCharsAsNumbers=false)
kodo.jdbc.SequenceFactory: PrimaryKeyColumn=PKX, SequenceColumn=SEQUENCEX,
TableName=JDO_SEQUENCEX
and if the filter is:lastName.matches('.*z.*'), it works well.
Thanks a lot.
Marc Prud'hommeaux
SolarMetric Inc. -
JDBC drivers for postgres+classpath for windows
I've written an application for university last year, that connects to a postgres database. It worked perfectly on the Debian, but I'm trying to run it on Windows 2000 now.
I've downloaded the driver http://jdbc.postgresql.org/download/postgresql-8.0-311.jdbc3.jar but now what do I need to write in the "Class.forName(String name)" line , as I've put the jar in c:\ ?
Other question while I'm typing : my other java applications run correctly althought no classpath variable exists in the system. How can I set it easily and how can I add the postgres drivers to it ? ( I know how to under Linux, not windows )You write Class.forName() using the name of the PostgreSQL driver class, just like you always do.
As far as classpath goes, you set that the same way, too: using the -classpath option when you run java.exe.
You shouldn't have a CLASSPATH variable in the system. One size does not fit all. You should know how to set it every time you compile and run using the -classpath option for javac.exe and java.exe. Read the javadocs for these tools.
% -
Can anybody give me the jdbc code for postgres database.
Hello all,
I tried to search for sample jdbc code for postgres. But I couldn't find working sample. Can anybody please post the sample jdbc code for connecting to postgres database.
I have already added the jar file, "postgresql-8.0-312.jdbc3.jar" to the build path.
Thanks.
SrinivasHi,
Thanks for your reply!
I wrote the following code, but the insert doesn't add a row.
try {
Class.forName("org.postgresql.Driver");
//Preparing Conenction String
Connection con = DriverManager.getConnection("jdbc:postgresql://<name>:5432/sales_office_test", "sales_office_data","sales_office_data");
PreparedStatement prepSt = con.prepareStatement(
"INSERT INTO office_personnel (office_id, salutation, firstname, lastname, email_address,"
+ " cellphone, phonenumber, extension, password, username) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
prepSt.setString(1, newOfficeIds);
prepSt.setString(2, whopperUserSalutation);
//Close statement
prepSt.close();
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}If I print the connection object I get
Sql connection value: org.postgresql.jdbc3.Jdbc3Connection@10965c3 I double checked the same query by directly executing it on the web interface to the postgres, works fine there and creates the row...
What could be wrong.
Thanks
Srinivas -
Run application with jdbc driver for postgres 7.4
I execute my application in the following way:
java -jar myapplication.jar
but when being executed it doesn't find the connection driver creating a big error in mi application.
that I can make so that my application finds the driver when being executed?
Help meeeee please!!!!Presumably the JDBC driver is already in its own jar file. You should include a Class-Path entry referring to that jar file in the manifest of your myapplication.jar file.
-
How to connect to Pgsql on server through jdbc with java on local machine
I am developing an application in which I have to connect to my database that is in Pgsql and Pgsql is installed on Linux server. I am going to access that from my java program and the java is here on my local computer(in Linux). All the intranet connections are there. How can I get accees to that database? I have heard of java SSL tunnel. Is this the only solution or there is something else that I can use more easily. Also if I use java installed on th same server as Pgsql then what I will have to do to call the java methods using AMI. Will the java at server be able to make connection to Pgsql more easily? Please tell me about it if you know.
ThanksThe closer java and pgsql, the easier it is of course to connect. So the easiest way is to have everything on the same machine. If you are in the same network you will need an IP based network, which is pretty much standard these days. In this case you need to modify the pg_hba.conf file to allow connections from other machines. In both cases you have to start the postmaster with the -i option to enable enable TCP/IP connections.
Having java and pgsql connected through the internet is a different story, I do not have any experience with that. But you can use ssh to build a tunnel and connect to a local ip address / port from java which is then forwared securely via the internet to the server.
In all cases you will need the postgres jdbc driver in your classpath. You can find information about postgres and jdbc on the postgres web site.
good luck -
Table does not exist (servlet accessing the postgres sql table)
Hello every body,
I am running servlet to access the postgres sql table. But there exist error.
ERROR: relation "employee" does not exist
I have checked the table name in database and table name into the servlet. Both are same. Please give me suggestion to solve this error.
Thankscan you connect to the database without the servlet?
put your stuff into this and try it. If it works, add something to check the table names. - %
package test;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
* Connect to a database using JDBC
public class ConnectionTest
private static final String DEFAULT_DRIVER = "your driver here";
private static final String DEFAULT_URL = "your url here";
private static final String DEFAULT_USERNAME = "your username here";
private static final String DEFAULT_PASSWORD = "your password here";
public static void main(String[] args)
Connection connection = null;
ResultSet rs = null;
try
String driver = ((args.length > 0) ? args[0] : DEFAULT_DRIVER);
Class.forName(driver);
String url = ((args.length > 1) ? args[1] : DEFAULT_URL);
String username = ((args.length > 2) ? args[2] : DEFAULT_USERNAME);
String password = ((args.length > 3) ? args[3] : DEFAULT_PASSWORD);
connection = DriverManager.getConnection(url, username, password);
DatabaseMetaData databaseMetaData = connection.getMetaData();
System.out.println("product: " + databaseMetaData.getDatabaseProductName());
System.out.println("major : " + databaseMetaData.getDatabaseMajorVersion());
System.out.println("minor : " + databaseMetaData.getDatabaseMinorVersion());
System.out.println("schemas");
rs = databaseMetaData.getSchemas();
while (rs.next())
System.out.println(rs.getString(1));
catch (Exception e)
e.printStackTrace();
finally
close(rs);
close(connection);
public static void close(ResultSet resultSet)
try
if (resultSet != null)
resultSet.close();
catch (Exception e)
e.printStackTrace();
public static void close(Statement statement)
try
if (statement != null)
statement.close();
catch (Exception e)
e.printStackTrace();
public static void close(Connection connection)
try
if (connection != null)
connection.close();
catch (Exception e)
e.printStackTrace();
} -
Exception - Deploying CMP bean with Postgres DB
Hi,
When I deploy a CMP bean in Weblogic6.1 configured with Postgres Database it throws the following exception.
<Oct 22, 2002 5:55:10 PM IST> <Error> <J2EE> <Error deploying application EjbTes
t:
Unable to deploy EJB: EjbTest.jar from EjbTest.jar:
Exception: 'java.lang.NullPointerException' while trying to invoke: setB
eanParamsForCreate at line 25
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:302)
at weblogic.ejb20.deployer.Deployer.runEJBC(Deployer.java:296)
at weblogic.ejb20.deployer.Deployer.compileEJB(Deployer.java:684)
at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:851)
<Oct 22, 2002 5:55:10 PM IST> <Error> <Management> <Error deploying application
.\config\siptech\applications\EjbTest.jar: java.lang.reflect.UndeclaredThrowable
Exception>
Thankx,
JaganHi. This isn't a jdbc question, so you'll have better luck posting this to the ejb group.
Joe
Jagan wrote:
Hi,
When I deploy a CMP bean in Weblogic6.1 configured with Postgres Database it throws the following exception.
<Oct 22, 2002 5:55:10 PM IST> <Error> <J2EE> <Error deploying application EjbTes
t:
Unable to deploy EJB: EjbTest.jar from EjbTest.jar:
Exception: 'java.lang.NullPointerException' while trying to invoke: setB
eanParamsForCreate at line 25
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:302)
at weblogic.ejb20.deployer.Deployer.runEJBC(Deployer.java:296)
at weblogic.ejb20.deployer.Deployer.compileEJB(Deployer.java:684)
at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:851)
<Oct 22, 2002 5:55:10 PM IST> <Error> <Management> <Error deploying application
.\config\siptech\applications\EjbTest.jar: java.lang.reflect.UndeclaredThrowable
Exception>
Thankx,
Jagan -
How to connect to postgres server
I need to connect to a postgres server using jdbc. I don't know the parameter for my
Class.forName() or anything that could help me connect to the server. Could someone
help me about this problem.
thanks a millionHi Zennen,
Just use the below code to connect to the database,
Class.forName("org.postgresql.Driver");
Connection con = DriverManager.getConnection("jdbc:postgresql://serverIPAddress/Databasename,"Userid","password");
Try this it will work fine. -
How to add new JDBC driver ?
OS - Linux
SunAppServ 9.1
Hi, I want to create in AdminPanel on 4848 port new ConnectionPool in Resources/JDBC.
To do this I can chose Postgres Vendor but I want to use my new Postgres driver because default is not work.
I hava postgresql-8.2-505.jdbc4.jar file
in this file there is a directories org/postgresql/ds/PGPoolingDataSource.class which I want to use.
Where I should copy this postgresql-8.2...jar file
I tried copy to JEE5_HOME/lib/. and in secend step i write class postgresql-8.2-505.jdbc4.org.postgresql.ds.PGPoolingDataSource
but this doesn't work.
BTW this driver work in NetBeans (I have jdbc connection in Runtime and linked this driver)Please Refer :
1) http://blogs.sun.com/JagadishPrasath/entry/creating_jdbc_connection_pool_resource
2) http://blogs.sun.com/JagadishPrasath/entry/jdbc_connection_pool_templates_glassfish -
Problem with using Postgres database in java.
Hi ,
I am using netbean netbean IDE 6.1.5 and postgres as my database.
I want to pass a date to a query in java like-
"select count(\"JOBID\") from emp
to_char(\"STARTTIME\",'yyyy-MM-dd')=" + datestr
where STARTTIME is a date field,
but when I run the program it gives the error
error: operator does not exist: text = integer
even if I use this query
ResultSet result1= stmt.executeQuery("select count(\"JOBID\") frrom emp "+
" where to_date(\"STARTTIME\",'YYYY-MM-DD HH:MI:SS')=" + sqlDate);
WHERE STARTDATE is string and
sqlDate=java.sql.Date sqlDate
it gives
error:error: operator does not exist: date = integer
please help
moniUse PreparedStatement instead of Statement all the way. Not only it is faster and saves you from any SQL injection risks, but it also eases setting complex Java objects in a SQL query. It has for example a setDate() method.
Prepare here: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html].
Maybe you are looking for
-
I'm hoping to sync iCal via my four apple devices through the iCloud. Unfortunately, I used two different Apple IDs when setting up the iCloud accounts on the devices. How can I change the Aplle ID associated with my iPhone so that it's the same one
-
Error -201064 occurred at _DAQmxImportConfig.vi
I have an exported NI MAX configuration file from another machine, call it x.nce. I successfully imported this to my machine using MAX, but now I wantto import all of the tasks, channels, scales into a Labview project. The .nce file isn't supported
-
We've set 60 min as session timeout and AM pool parameters also high (<AM-Pooling jbo.ampool.maxinactiveage="1200000" jbo.ampool.initpoolsize="25" jbo.ampool.maxpoolsize="1000" jbo.recyclethreshold="50" jbo.ampool.maxavailablesize="50" jbo.ampool.mi
-
RV042 - Load Balancing question
Hi, I have the RV042 (firmware 1.3.13.02-tm) in Load Balancing mode. When I do a speedtest, the result is the total bandwidth available on my 2 connections, i.e. 8-9,000 Kbit/Sec (each line is approx 4,500 Kbit/Sec). When I stream from Netflix, the b
-
Accessing Tables via Database Links.
Hello. I have created a database link in order to allow me to access tables that exist in a database separate from the one that APEX exists on. The link seems to work because I can query these tables in the APEX SQL Commands windows by running the fo