Estou começando a aprender java web com banco de dados usando wildfly jpa, estou fazendo um projeto de gerenciamento de academia, a parte de páginas web já está pronta, mesmo programação em java, o problema é quando uso jpa para criar a tabela no mysql do wildfly log mostra que criou a tabela, mas não aparece no mysql, eu atualizo e nada.
O IDE que estou usando é NETBENS SE ISTO FOR ÚTIL
Agradeço antecipadamente por sua ajuda!!
O log que o wildfly me mostra
JAVA: "C:\Program Files\Java\jdk-16.0.1\bin\java"
JAVA_OPTS: "-Dprogram.name=standalone.bat -Xms128m -Xmx512m -server -Dhttp.nonProxyHosts=localhost,127.0.0.1,RUAN-LAPTOP -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.management.http.port=9990 -Djboss.http.port=8080 --add-exports=java.desktop/sun.awt=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.management/javax.management=ALL-UNNAMED --add-opens=java.naming/javax.naming=ALL-UNNAMED"
===============================================================================
04:48:24,939 INFO [org.jboss.modules] (main) JBoss Modules version 1.11.0.Final
04:48:25,223 INFO [org.jboss.msc] (main) JBoss MSC version 1.4.12.Final
04:48:25,228 INFO [org.jboss.threads] (main) JBoss Threads version 2.4.0.Final
04:48:25,297 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 24.0.0.Final (WildFly Core 16.0.0.Final) starting
04:48:25,715 INFO [org.wildfly.security] (ServerService Thread Pool -- 29) ELY00001: WildFly Elytron version 1.16.0.Final
04:48:26,002 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 27) WFLYCTL0033: Extension 'security' is deprecated and may not be supported in future versions
04:48:26,226 INFO [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
04:48:26,252 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 20) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
04:48:26,286 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found Academia.war in deployment directory. To trigger deployment create a file called Academia.war.dodeploy
04:48:26,335 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
04:48:26,347 INFO [org.xnio] (MSC service thread 1-3) XNIO version 3.8.4.Final
04:48:26,356 INFO [org.xnio.nio] (MSC service thread 1-3) XNIO NIO Implementation Version 3.8.4.Final
04:48:26,385 INFO [org.wildfly.extension.microprofile.jwt.smallrye] (ServerService Thread Pool -- 70) WFLYJWT0001: Activating MicroProfile JWT Subsystem
04:48:26,389 INFO [org.wildfly.extension.health] (ServerService Thread Pool -- 55) WFLYHEALTH0001: Activating Base Health Subsystem
04:48:26,394 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 80) WFLYTX0013: The node-identifier attribute on the /subsystem=transactions is set to the default value. This is a danger for environments running multiple servers. Please make sure the attribute value is unique.
04:48:26,400 INFO [org.wildfly.extension.microprofile.config.smallrye] (ServerService Thread Pool -- 69) WFLYCONF0001: Activating MicroProfile Config Subsystem
04:48:26,401 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 57) WFLYCLINF0001: Activating Infinispan subsystem.
04:48:26,402 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 72) WFLYNAM0001: Activating Naming Subsystem
04:48:26,402 INFO [org.jboss.as.security] (ServerService Thread Pool -- 78) WFLYSEC0002: Activating Security Subsystem
04:48:26,404 INFO [org.wildfly.iiop.openjdk] (ServerService Thread Pool -- 56) WFLYIIOP0001: Activating IIOP Subsystem
04:48:26,414 INFO [org.jboss.as.jaxrs] (ServerService Thread Pool -- 59) WFLYRS0016: RESTEasy version 3.15.1.Final
04:48:26,415 INFO [org.jboss.as.security] (MSC service thread 1-6) WFLYSEC0001: Current PicketBox version=5.0.3.Final-redhat-00007
04:48:26,423 INFO [org.wildfly.extension.microprofile.opentracing] (ServerService Thread Pool -- 71) WFLYTRACEXT0001: Activating MicroProfile OpenTracing Subsystem
04:48:26,424 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 64) WFLYJSF0007: Activated the following Jakarta Server Faces Implementations: [main]
04:48:26,425 INFO [org.wildfly.extension.metrics] (ServerService Thread Pool -- 68) WFLYMETRICS0001: Activating Base Metrics Subsystem
04:48:26,445 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 82) WFLYWS0002: Activating WebServices Extension
04:48:26,472 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0003: Undertow 2.2.8.Final starting
04:48:26,475 INFO [org.jboss.as.connector] (MSC service thread 1-2) WFLYJCA0009: Starting Jakarta Connectors Subsystem (WildFly/IronJacamar 1.4.35.Final)
04:48:26,482 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 47) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
04:48:26,490 INFO [org.jboss.as.naming] (MSC service thread 1-1) WFLYNAM0003: Starting Naming Service
04:48:26,494 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
04:48:26,542 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 47) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.cj.jdbc.Driver (version 8.0)
04:48:26,556 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2
04:48:26,561 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = mysql
04:48:26,576 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 81) WFLYUT0014: Creating file handler for path 'C:\Users\Ruan Pablo\Documents\PROGRAMAS\wildfly-24.0.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
04:48:26,579 WARN [org.wildfly.extension.elytron] (MSC service thread 1-2) WFLYELY00023: KeyStore file 'C:\Users\Ruan Pablo\Documents\PROGRAMAS\wildfly-24.0.0.Final\standalone\configuration\application.keystore' does not exist. Used blank.
04:48:26,614 WARN [org.wildfly.extension.elytron] (MSC service thread 1-1) WFLYELY01084: KeyStore C:\Users\Ruan Pablo\Documents\PROGRAMAS\wildfly-24.0.0.Final\standalone\configuration\application.keystore not found, it will be auto generated on first use with a self-signed certificate for host localhost
04:48:26,834 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 58) WFLYIO001: Worker 'default' has auto-configured to 24 IO threads with 192 max task threads based on your 12 available processors
04:48:26,837 INFO [org.jboss.as.ejb3] (MSC service thread 1-4) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 48 (per class), which is derived from the number of CPUs on this host.
04:48:26,837 INFO [org.jboss.as.ejb3] (MSC service thread 1-8) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 192 (per class), which is derived from thread worker pool sizing.
04:48:26,860 INFO [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 5.0.23.Final
04:48:26,868 INFO [org.jboss.as.patching] (MSC service thread 1-3) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
04:48:26,881 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-2) WFLYDM0111: Keystore C:\Users\Ruan Pablo\Documents\PROGRAMAS\wildfly-24.0.0.Final\standalone\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
04:48:26,886 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-8) WFLYDS0013: Started FileSystemDeploymentService for directory C:\Users\Ruan Pablo\Documents\PROGRAMAS\wildfly-24.0.0.Final\standalone\deployments
04:48:26,894 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "Academia.war" (runtime-name: "Academia.war")
04:48:26,907 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0012: Started server default-server.
04:48:26,911 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) Queuing requests.
04:48:26,913 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0018: Host default-host starting
04:48:26,939 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
04:48:26,939 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
04:48:26,944 INFO [org.jboss.as.ejb3] (MSC service thread 1-6) WFLYEJB0493: Jakarta Enterprise Beans subsystem suspension complete
04:48:26,954 INFO [org.wildfly.extension.messaging-activemq] (MSC service thread 1-3) WFLYMSGAMQ0001: AIO wasn't located on this platform, it will fall back to using pure Java NIO.
04:48:27,047 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
04:48:27,047 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) WFLYJCA0001: Bound data source [java:/jdbc/AcademiaDS]
04:48:27,051 INFO [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBossWS 5.4.4.Final (Apache CXF 3.3.10)
04:48:27,058 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=C:\Users\Ruan Pablo\Documents\PROGRAMAS\wildfly-24.0.0.Final\standalone\data\activemq\journal,bindingsDirectory=C:\Users\Ruan Pablo\Documents\PROGRAMAS\wildfly-24.0.0.Final\standalone\data\activemq\bindings,largeMessagesDirectory=C:\Users\Ruan Pablo\Documents\PROGRAMAS\wildfly-24.0.0.Final\standalone\data\activemq\largemessages,pagingDirectory=C:\Users\Ruan Pablo\Documents\PROGRAMAS\wildfly-24.0.0.Final\standalone\data\activemq\paging)
04:48:27,096 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221013: Using NIO Journal
04:48:27,141 INFO [org.wildfly.iiop.openjdk] (MSC service thread 1-1) WFLYIIOP0009: CORBA ORB Service started
04:48:27,172 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
04:48:27,174 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
04:48:27,174 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
04:48:27,175 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
04:48:27,231 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221034: Waiting indefinitely to obtain live lock
04:48:27,231 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221035: Live Server Obtained live lock
04:48:27,570 INFO [org.jboss.as.jpa] (MSC service thread 1-1) WFLYJPA0002: Read persistence.xml for AcademiaPU
04:48:27,679 INFO [org.jipijapa] (MSC service thread 1-5) JIPIORMV53020253: Second level cache enabled for Academia.war#AcademiaPU
04:48:27,834 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221003: Deploying ANYCAST queue jms.queue.ExpiryQueue on address jms.queue.ExpiryQueue
04:48:27,840 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221003: Deploying ANYCAST queue jms.queue.DLQ on address jms.queue.DLQ
04:48:27,853 INFO [org.wildfly.extension.messaging-activemq] (MSC service thread 1-3) WFLYMSGAMQ0016: Registered HTTP upgrade for activemq-remoting protocol handled by http-acceptor-throughput acceptor
04:48:27,853 INFO [org.wildfly.extension.messaging-activemq] (MSC service thread 1-8) WFLYMSGAMQ0016: Registered HTTP upgrade for activemq-remoting protocol handled by http-acceptor acceptor
04:48:27,853 INFO [org.wildfly.extension.messaging-activemq] (MSC service thread 1-5) WFLYMSGAMQ0016: Registered HTTP upgrade for activemq-remoting protocol handled by http-acceptor acceptor
04:48:27,853 INFO [org.wildfly.extension.messaging-activemq] (MSC service thread 1-2) WFLYMSGAMQ0016: Registered HTTP upgrade for activemq-remoting protocol handled by http-acceptor-throughput acceptor
04:48:27,904 INFO [org.jboss.weld.deployer] (MSC service thread 1-6) WFLYWELD0003: Processing weld deployment Academia.war
04:48:28,000 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-6) HV000001: Hibernate Validator 6.0.22.Final
04:48:28,054 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221007: Server is now live
04:48:28,054 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 84) AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.16.0 [default, nodeID=21e8abfa-e792-11eb-912b-005056c00001]
04:48:28,060 INFO [org.infinispan.CONTAINER] (ServerService Thread Pool -- 85) ISPN000128: Infinispan version: Infinispan 'Taedonggang' 12.1.4.Final
04:48:28,065 INFO [org.wildfly.extension.messaging-activemq] (ServerService Thread Pool -- 84) WFLYMSGAMQ0002: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
04:48:28,076 INFO [org.wildfly.extension.messaging-activemq] (ServerService Thread Pool -- 88) WFLYMSGAMQ0002: Bound messaging object to jndi name java:/ConnectionFactory
04:48:28,092 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 85) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'Academia.war#AcademiaPU'
04:48:28,107 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 85) HHH000204: Processing PersistenceUnitInfo [
name: AcademiaPU
...]
04:48:28,107 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-1) WFLYJCA0007: Registered connection factory java:/JmsXA
04:48:28,156 INFO [org.apache.activemq.artemis.ra] (MSC service thread 1-1) AMQ151007: Resource adaptor started
04:48:28,157 INFO [org.jboss.as.connector.services.resourceadapters.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-1) IJ020002: Deployed: file://RaActivatoractivemq-ra
04:48:28,159 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-4) WFLYJCA0002: Bound Jakarta Connectors ConnectionFactory [java:/JmsXA]
04:48:28,159 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-8) WFLYJCA0118: Binding connection factory named java:/JmsXA to alias java:jboss/DefaultJMSConnectionFactory
04:48:28,178 INFO [org.hibernate.Version] (ServerService Thread Pool -- 85) HHH000412: Hibernate Core {5.3.20.Final}
04:48:28,179 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 85) HHH000206: hibernate.properties not found
04:48:28,262 INFO [org.infinispan.CONFIG] (MSC service thread 1-2) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
04:48:28,263 INFO [io.jaegertracing.internal.JaegerTracer] (MSC service thread 1-6) No shutdown hook registered: Please call close() manually on application shutdown.
04:48:28,264 INFO [org.infinispan.CONFIG] (MSC service thread 1-2) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
04:48:28,264 INFO [org.wildfly.microprofile.opentracing.smallrye] (MSC service thread 1-6) WFLYTRAC0001: Tracer initialized: JaegerTracer(version=Java-1.5.0, serviceName=Academia.war, reporter=RemoteReporter(sender=org.wildfly.extension.microprofile.opentracing.spi.sender.WildFlySender@46fd8233, closeEnqueueTimeout=1000), sampler=ConstSampler(decision=true, tags={sampler.type=const, sampler.param=true}), tags={hostname=RUAN-LAPTOP, jaeger.version=Java-1.5.0, ip=169.254.192.206}, zipkinSharedRpcSpan=false, expandExceptionLogs=false, useTraceId128Bit=false)
04:48:28,283 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 85) HCANN000001: Hibernate Commons Annotations {5.0.5.Final}
04:48:28,299 INFO [org.infinispan.CONTAINER] (ServerService Thread Pool -- 88) ISPN000556: Starting user marshaller 'org.wildfly.clustering.infinispan.spi.marshalling.InfinispanProtoStreamMarshaller'
04:48:28,304 INFO [org.jipijapa] (MSC service thread 1-5) JIPIORMV53020253: Second level cache enabled for Academia.war#AcademiaPU
04:48:28,411 INFO [org.jboss.weld.Version] (MSC service thread 1-5) WELD-000900: 3.1.7 (SP1)
04:48:28,433 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 88) WFLYCLINF0002: Started http-remoting-connector cache from ejb container
04:48:28,558 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 88) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'Academia.war#AcademiaPU'
04:48:28,658 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 88) HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
04:48:28,695 INFO [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 88) Envers integration enabled? : true
04:48:28,997 INFO [stdout] (ServerService Thread Pool -- 88) Hibernate:
04:48:28,997 INFO [stdout] (ServerService Thread Pool -- 88)
04:48:28,997 INFO [stdout] (ServerService Thread Pool -- 88) drop table if exists Estado
04:48:29,001 INFO [stdout] (ServerService Thread Pool -- 88) Hibernate:
04:48:29,001 INFO [stdout] (ServerService Thread Pool -- 88)
04:48:29,001 INFO [stdout] (ServerService Thread Pool -- 88) create table Estado (
04:48:29,001 INFO [stdout] (ServerService Thread Pool -- 88) SIGLA varchar(255) not null auto_increment,
04:48:29,001 INFO [stdout] (ServerService Thread Pool -- 88) NOME varchar(255),
04:48:29,002 INFO [stdout] (ServerService Thread Pool -- 88) primary key (SIGLA)
04:48:29,002 INFO [stdout] (ServerService Thread Pool -- 88) ) engine=InnoDB
04:48:29,008 INFO [org.hibernate.tool.schema.internal.SchemaCreatorImpl] (ServerService Thread Pool -- 88) HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@28ccd72b'
04:48:29,062 WARN [org.jboss.weld.Bootstrap] (MSC service thread 1-8) WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class com.sun.faces.flow.FlowDiscoveryCDIHelper is deprecated from CDI 1.1!
04:48:29,413 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 107) Inicializando Mojarra 2.3.14.SP04 para o contexto '/Academia'
04:48:29,771 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 107) WFLYUT0021: Registered web context: '/Academia' for server 'default-server'
04:48:29,828 INFO [org.jboss.as.server] (ServerService Thread Pool -- 48) WFLYSRV0010: Deployed "Academia.war" (runtime-name : "Academia.war")
04:48:29,859 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
04:48:29,861 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 24.0.0.Final (WildFly Core 16.0.0.Final) started in 5162ms - Started 782 of 963 services (366 services are lazy, passive or on-demand)
04:48:29,863 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
04:48:29,863 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
Seguinte: No servidor A estou tentando fazer uma consulta com o servidor B, mas está dando erro.
Estou usando o mesmo código de conexão do servidor B que funciona perfeitamente, mas no servidor A, dá erro.
Segue código:
// conexão e seleção do banco de dados
$conexao = mysqlI_connect($host, $user, $pass, $db);
mysqlI_set_charset($conexao,"utf8");
//print "Conexão rodando e OK!";
//mysqlI_close($conexao);
Há alguns dias que venho instalar o apache, o php, mysql e o phpmyadmin manualmente e sem obter sucesso. Até consegui rodar o php, porém, quando vou baixar a úitima versão do MYSQL, não tem todos os pacotes nele instalados, inclusive no completo, só encontro o Router.
Alguém pode me dizer o porquê que isso está ocorrendo?
Desde já agradeço a ajuda de vocês, que será bem vinda!
No aguardo!
Uso a versão 8.3.9 do PHP
Meu SO é o Windows 10 32 bits
Tenho uma tabela chamada "item" com os seguintes campos: id, name, active. Nela tem cadastrado vários itens.
No campo "active" eu coloco a letra "S" para informar que este item está ativo no sistema. Por exemplo:
1, casa, S
2, mesa, S
3, cama, S
4, moto S
5, rádio
O quinto registro "radio" não está ativo no sistema pois não tem um "S" no campo active.
E outra tabela chamada "product" com os seguintes campos (id, name) com os seguintes registros:
1, Produto A
2, Produto B
3, Produto C
E uma terceira tabela chamada "product_item" com os seguintes campos (productID, itemID). No campo productID eu coloco o id de um produto da tabela "product" e no campo "itemID" eu coloco o id do produto da tabela "item". Exemplo:
1, 1
1, 3
1, 4
2, 3
2, 4
Sendo assim o produto A da tabela 'product" comtem os itens casa, cama e moto.
Eu preciso fazer uma busca da seguinte maneira:
Eu escolho um registro da tabela "item", por exemplo "casa". Preciso fazer com que o php me liste todos os registros da tabela "product" que contenham a palavra "casa" e que os demais itens estejam ativos no siste. Ou seja, que contenham um "S" no campo "active"
Eu consegui fazer isso da seguinte maneira:
SELECT P.id, P.name, GROUP_CONCAT(I.name ORDER BY I.name) AS items
FROM product P
JOIN product_item PI ON P.id = PI.productID
JOIN item I ON I.id = PI.itemID AND I.active = 'S'
WHERE P.id NOT IN (
SELECT PI.productID
FROM product_item PI
JOIN item I ON I.id = PI.itemID
WHERE I.active IS NULL
)
AND P.id IN (
SELECT PI.productID
FROM product_item PI
JOIN item I ON I.id = PI.itemID
WHERE I.name = 'mesa'
)
GROUP BY P.id, P.name;
O problema que eu estou tendo é o seguinte:
Quando eu jogo este código para o banco de dados onde eu já tenho os registros cadastrado o php fica lendo uma eternidade e não lista os produtos.
Usando código no banco de dados que eu fiz para testes ele funciona perfeitamente pois nele tem poucos registros.
No banco de dados principal a tabela "item" tem 11.196 registros. A tabela "product" tem 88.214 registros e a tabela "product_item" tem 518.378 registros.
Eu acredito que, devido o banco de dados ser muito grande, ele não consegue listar.
Boa tarde pessoal.
Estou tentado fazer uma consulta no banco de dados porém estou tendo dificuldades.
Tenho uma tabela chamada "itens" com os seguintes campos: id, item, ativo. Nela tem cadastrado vários itens.
No campo ativo eu coloco a letra "S" para informar que este item está ativo no sistema. Por exemplo:
1, casa, S
2, mesa, S
3, cama, S
4, moto S
5, rádio
O quinto registro "radio" não está ativo no sistema pois não tem um "S" no campo ativo.
E outra tabela chamada "produtos" com os seguintes campos (id, item1, item2, item3) com os seguintes registros:
1, casa, mesa, moto
2, mesa, casa, cama
3, rádio, cama, mesa
Eu preciso fazer uma busca na tabela produtos da seguinte maneira:
Eu escolho um registro na tabela "itens", por exemplo "mesa". Preciso fazer com que o php me liste todos os registros da tabela "produtos" que contenham a palavra "mesa".
Até aqui tudo bem eu consigo listar.
Estou fazendo assim:
<?php
$item = "mesa"
$sql = mysqli_query($conn, "SELECT * FROM produtos WHERE item1 LIKE '$item' OR item2 LIKE '$item' OR item3 LIKE '$item' LIMIT 10");
while($aux = mysqli_fetch_assoc($sql)) {
$id = $aux["id"];
$item1 = $aux["item1"];
$item2 = $aux["item2"];
$item3 = $aux["item3"];
echo $id . " - " . $item1 . ", " . $item2 . ", " $item3 . "<br>";
}
?>
O problema é que está listando todos os registros que contém o item mesa.
Eu preciso que o php verifique os demais item e me liste somente os registro em que todos os registros estejam ativos no sistema.
No exemplo acima ele não deveria listar o registro 3. pois nesse registro contém o item "radio" e este item não está ativo no sistema. Ou seja, o registro "radio" na tabela itens não possui um "S" na coluna "ativo".
Alguém sabe como resolver isso?
Eu estou criando um sistema do zero mas estou encontnrando algumas dificuldades e não estou sabendo resolver, então vim recorrer ajuda de vocês.
Aqui está todo o meu código: https://github.com/PauloJagata/aprendizado/
Eu fiz um sistema de rotas mas só mostra o conteúdo da '/' não sei porque, quando eu tento acessar o register nada muda.
E eu também quero que se não estiver liberado na rota mostra o erro de 404, mas quando eu tento acessar um link inválido, nada acontece.
Alguém pode me ajudar com isso? E se tiver algumas sugestão para melhoria do código também estou aceitando.
Estou começando a aprender java web com banco de dados usando wildfly jpa, estou fazendo um projeto de gerenciamento de academia, a parte de páginas web já está pronta, mesmo programação em java, o problema é quando uso jpa para criar a tabela no mysql do wildfly log mostra que criou a tabela, mas não aparece no mysql, eu atualizo e nada.
O IDE que estou usando é NETBENS SE ISTO FOR ÚTIL
Agradeço antecipadamente por sua ajuda!!
O log que o wildfly me mostra
Minha Persistence.xml
A class que quero gerar a tabela no mysql
Compartilhar este post
Link para o post
Compartilhar em outros sites